This commit is contained in:
mountaindrew10 committed 2024-01-05 20:46:06 -06:00
commit 098ab4f95c
47 files changed
+1221 -121

No files matched your search

+3 -3
View File
@@ -193,14 +193,14 @@ namespace CalamityMod.Balancing
#endregion
#region Lunatic Cultist
// 25% resist to Resurrection Butterfly.
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.CultistBoss, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType<SakuraBullet>(), ProjectileType<PurpleButterfly>()))));
// 20% resist to Art Attack.
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.CultistBoss, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType<ArtAttackStrike>()))));
// 20% resist to Nightglow.
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.CultistBoss, Do(new ProjectileResistBalancingRule(0.8f, ProjectileID.FairyQueenMagicItemShot))));
// 20% resist to Resurrection Butterfly.
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.CultistBoss, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType<SakuraBullet>(), ProjectileType<PurpleButterfly>()))));
#endregion
#region Astrum Deus
+25
View File
@@ -0,0 +1,25 @@
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.StatBuffs
{
public class Haste : ModBuff
{
public override void SetStaticDefaults()
{
Main.debuff[Type] = false;
Main.pvpBuff[Type] = true;
Main.buffNoSave[Type] = true;
Main.buffNoTimeDisplay[Type] = true;
}
public override void Update(Player player, ref int buffIndex)
{
// keep the buff active as long as the player's haste level is up
if (player.Calamity().hasteLevel > 0)
{
player.buffTime[buffIndex] = 60;
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 543 B

+17 -4
View File
@@ -978,6 +978,8 @@ namespace CalamityMod.CalPlayer
public bool avertorBonus = false;
public bool divineBless = false;
public bool infiniteFlight = false;
public int hasteCounter = 0;
public int hasteLevel = 0;
#endregion
#region Minion
@@ -2469,6 +2471,8 @@ namespace CalamityMod.CalPlayer
healingPotionMultiplier = 1f;
avertorBonus = false;
divineBless = false;
hasteLevel = 0;
hasteCounter = 0;
#endregion
#region Armor Set Bonuses
@@ -3656,7 +3660,8 @@ namespace CalamityMod.CalPlayer
(silvaSet ? 0.05f : 0f) +
(blueCandle ? 0.05f : 0f) +
(planarSpeedBoost > 0 ? (0.01f * planarSpeedBoost) : 0f) +
((deepDiver && Player.IsUnderwater()) ? 0.15f : 0f);
((deepDiver && Player.IsUnderwater()) ? 0.15f : 0f) +
(hasteLevel * 0.05f);
float runSpeedMult = 1f +
(lunicCorpsLegs ? 0.1f : 0f) +
@@ -3670,7 +3675,8 @@ namespace CalamityMod.CalPlayer
(CobaltSet ? CobaltArmorSetChange.SpeedBoostSetBonusPercentage * 0.01f : 0f) +
(silvaSet ? 0.05f : 0f) +
(planarSpeedBoost > 0 ? (0.01f * planarSpeedBoost) : 0f) +
((deepDiver && Player.IsUnderwater()) ? 0.15f : 0f);
((deepDiver && Player.IsUnderwater()) ? 0.15f : 0f) +
(hasteLevel * 0.05f);
if ((Player.slippy || Player.slippy2) && Player.iceSkate)
runAccMult *= 0.6f;
@@ -4813,8 +4819,15 @@ namespace CalamityMod.CalPlayer
if (CalamityConfig.Instance.SpeedrunTimer)
CalamityMod.SpeedrunTimer.Restart();
// Set a random delay between 12 and 20 seconds. When this delay hits zero, the music mod and wiki reminder messages display
if ((CalamityMod.Instance.musicMod is null && CalamityConfig.Instance.MusicModReminderMessage) || CalamityConfig.Instance.WikiStatusMessage)
//
// 04JAN2024: Ozzatron: Added a temporary message for the Gimme Swag plushie campaign.
// This message should not exist indefinitely. It is being pushed as a silent public update just for itself.
// As this message always displays and is not configurable, the previous rules about startup messages have been replaced with always-true.
//
// Set a random delay between 12 and 20 seconds. When this delay hits zero, startup messages display
bool plushieMessage = true;
if (plushieMessage || (CalamityMod.Instance.musicMod is null && CalamityConfig.Instance.MusicModReminderMessage) || CalamityConfig.Instance.WikiStatusMessage)
{
startMessageDisplayDelay = Main.rand.Next(CalamityUtils.SecondsToFrames(12), CalamityUtils.SecondsToFrames(20) + 1);
}
+29 -6
View File
@@ -945,7 +945,7 @@ namespace CalamityMod.CalPlayer
{
if (!Main.rand.NextBool(3))
continue;
Dust holyCinder = Dust.NewDustDirect(Player.position, Player.width, Player.height, (int)CalamityDusts.ProfanedFire);
holyCinder.velocity = Main.rand.NextVector2Circular(3.5f, 3.5f);
holyCinder.velocity.Y -= Main.rand.NextFloat(1f, 3f);
@@ -1017,7 +1017,7 @@ namespace CalamityMod.CalPlayer
Vector2 spawnPoint = new Vector2(Player.Center.X + Main.rand.Next(-1000, 1001), Player.Center.Y - Main.rand.Next(700, 801));
if (Player.miscCounter % slimeRainRate == 0f)
{
{
if (DownedBossSystem.downedAquaticScourge && !DownedBossSystem.downedPolterghast && Main.rand.NextBool(12))
{
NPC.NewNPC(new EntitySource_SpawnNPC(), (int)spawnPoint.X, (int)spawnPoint.Y, ModContent.NPCType<IrradiatedSlime>());
@@ -1111,7 +1111,7 @@ namespace CalamityMod.CalPlayer
{
Player.velocity.Y += Player.gravity * Player.gravDir * (BalancingConstants.HoldingDownGravityMultiplier - 1f);
if (Player.Calamity().gSabaton)
{
{
Player.maxFallSpeed *= 1.5f;
}
if (Player.velocity.Y * Player.gravDir > Player.maxFallSpeed)
@@ -1251,7 +1251,7 @@ namespace CalamityMod.CalPlayer
}
}
if (target > 0)
if (target > 0)
{
unstableSelectedTarget = Main.npc[target];
unstableSelectedTarget.Calamity().arcZapCooldown = 18;
@@ -1471,7 +1471,7 @@ namespace CalamityMod.CalPlayer
auralisAurora--;
if (auralisAuroraCooldown > 0)
auralisAuroraCooldown--;
if (blazingCore)
{
if (blazingCoreSuccessfulParry > 0)
@@ -1483,7 +1483,7 @@ namespace CalamityMod.CalPlayer
{
FlameLickedShell.HandleParryCountdown(Player);
}
// Silver Armor "Medkit" effect
if (silverMedkitTimer > 0)
{
@@ -1863,6 +1863,25 @@ namespace CalamityMod.CalPlayer
else if (polarisBoostCounter >= 10)
polarisBoostTwo = true;
// Haste buff
if (hasteLevel > 0)
{
// capped out at 3
if (hasteLevel > 3)
hasteLevel = 3;
// if the haste counter hits 5 seconds, subtract a haste level, and if there are none left afterwards, delete the buff
if (++hasteCounter == 300)
{
hasteLevel--;
if (hasteLevel <= 0)
{
if (Player.FindBuffIndex(ModContent.BuffType<Haste>()) > -1)
Player.ClearBuff(ModContent.BuffType<Haste>());
}
hasteCounter = 0;
}
}
// Calcium Potion buff
if (calcium)
Player.noFallDmg = true;
@@ -4118,10 +4137,14 @@ namespace CalamityMod.CalPlayer
CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Misc.WikiStatus1");
CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Misc.WikiStatus2");
}
if (CalamityMod.Instance.musicMod is null && CalamityConfig.Instance.MusicModReminderMessage)
{
CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Misc.MusicModReminder");
}
// 04JAN2024: Ozzatron: Plushie message always appears.
CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Misc.GimmeSwagPlushieCampaign");
}
--startMessageDisplayDelay;
+2 -2
View File
@@ -881,7 +881,7 @@ namespace CalamityMod.CalPlayer
titanCooldown = 15;
}
if (corrosiveSpine && modProj.stealthStrikeHitCount < 3)
if (corrosiveSpine && modProj.stealthStrikeHitCount < 3 && (Player.ownedProjectileCounts[ProjectileType<Corrocloud1>()] + Player.ownedProjectileCounts[ProjectileType<Corrocloud2>()] + Player.ownedProjectileCounts[ProjectileType<Corrocloud3>()]) < 3)
{
for (int i = 0; i < 3; i++)
{
@@ -903,7 +903,7 @@ namespace CalamityMod.CalPlayer
if (type != -1)
{
int damage = (int)Player.GetTotalDamage<RogueDamageClass>().ApplyTo(24);
int damage = (int)Player.GetTotalDamage<RogueDamageClass>().ApplyTo(22);
damage = Player.ApplyArmorAccDamageBonusesTo(damage);
float speed = Main.rand.NextFloat(5f, 11f);
+6 -6
View File
@@ -437,20 +437,20 @@ namespace CalamityMod.Items
modPlayer.canFireAtaxiaRogueProjectile = false;
int flareID = ModContent.ProjectileType<HydrothermicFlareRogue>();
// Ataxia Rogue Flares: 8 x 50%, soft cap starts at 120 base damage
int flareDamage = CalamityUtils.DamageSoftCap(damage * 0.5, 120);
// Ataxia Rogue Flares: 6 x 50%, soft cap starts at 90 base damage
int flareDamage = CalamityUtils.DamageSoftCap(damage * 0.5, 90);
flareDamage = player.ApplyArmorAccDamageBonusesTo(flareDamage);
if (player.whoAmI == Main.myPlayer)
{
SoundEngine.PlaySound(SoundID.Item20, player.Center);
float spread = 45f * 0.0174f;
float spread = 60f * 0.0174f;
double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2;
double deltaAngle = spread / 8f;
double deltaAngle = spread / 6f;
double offsetAngle;
for (int i = 0; i < 4; i++)
for (int i = 0; i < 3; i++)
{
offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i;
offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 30f * i;
Projectile.NewProjectile(source, player.Center.X, player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), flareID, flareDamage, 1f, player.whoAmI);
Projectile.NewProjectile(source, player.Center.X, player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), flareID, flareDamage, 1f, player.whoAmI);
}
@@ -1,5 +1,6 @@
using CalamityMod.Items.Materials;
using CalamityMod.Items.Materials;
using CalamityMod.Items.Placeables.FurnitureAshen;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Placeables.Furniture.CraftingStations
@@ -34,6 +35,7 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations
AddIngredient<SmoothBrimstoneSlag>(10).
AddIngredient<UnholyCore>(10).
AddTile(TileID.Anvils).
AddDecraftCondition(Condition.DownedMechBossAny).
Register();
}
}
@@ -1,7 +1,8 @@
using CalamityMod.Items.Materials;
using CalamityMod.Items.Materials;
using CalamityMod.Tiles.Furniture.CraftingStations;
using Terraria.ModLoader;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Placeables.FurnitureAshen
{
@@ -29,6 +30,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen
AddIngredient<SmoothBrimstoneSlag>(10).
AddIngredient<UnholyCore>(5).
AddTile<AshenAltar>().
AddDecraftCondition(Condition.DownedMechBossAny).
Register();
}
}
@@ -0,0 +1,88 @@
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.Melee;
using CalamityMod.Rarities;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Melee
{
public class ChronomancersScythe : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Melee";
public override void SetStaticDefaults()
{
ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true;
}
public override void SetDefaults()
{
Item.width = 45;
Item.height = 45;
Item.DamageType = TrueMeleeNoSpeedDamageClass.Instance;
Item.noMelee = true;
Item.noUseGraphic = true;
Item.channel = true;
Item.damage = 100;
Item.knockBack = 4f;
Item.useAnimation = 25;
Item.useTime = 5;
Item.autoReuse = false;
Item.useStyle = ItemUseStyleID.Shoot;
Item.UseSound = SoundID.Item71;
Item.value = CalamityGlobalItem.Rarity11BuyPrice;
Item.rare = ItemRarityID.Purple;
Item.Calamity().donorItem = true;
Item.shoot = ModContent.ProjectileType<ChronomancersScytheSwing>();
Item.shootSpeed = 24f;
}
public override bool AltFunctionUse(Player player) => true;
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
if (player.altFunctionUse == 2)
{
int p = Projectile.NewProjectile(source, position, Vector2.Zero, ModContent.ProjectileType<ChronomancersScytheHoldout>(), damage, knockback, Main.myPlayer, ai2: player.direction);
float rot = -MathHelper.PiOver2 + MathHelper.PiOver4;
Main.projectile[p].rotation = player.direction * rot;
return false;
}
else
{
return true;
}
}
public override bool CanUseItem(Player player)
{
if (player.altFunctionUse == 2f)
{
Item.reuseDelay = 10;
Item.channel = false;
Item.useTurn = false;
}
else
{
Item.reuseDelay = 0;
Item.channel = true;
Item.useTurn = true;
}
return base.CanUseItem(player);
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient(ItemID.IceSickle).
AddIngredient(ItemID.FastClock).
AddIngredient(ItemID.LunarBar, 10).
AddIngredient<CoreofEleum>(6).
AddTile(TileID.LunarCraftingStation).
Register();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

+2 -2
View File
@@ -10,7 +10,7 @@ namespace CalamityMod.Items.Weapons.Rogue
{
public class DefectiveSphere : RogueWeapon
{
public static int BaseDamage = 130;
public static int BaseDamage = 116;
public static float Speed = 15f;
public override void SetDefaults()
@@ -52,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Rogue
}
}
public override float StealthDamageMultiplier => 0.625f;
public override float StealthDamageMultiplier => 0.9f;
public override void ModifyStatsExtra(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback)
{
+3 -3
View File
@@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Rogue
{
Item.width = 34;
Item.height = 42;
Item.damage = 55;
Item.damage = 64;
Item.noMelee = true;
Item.noUseGraphic = true;
Item.useAnimation = Item.useTime = 20;
@@ -33,13 +33,13 @@ namespace CalamityMod.Items.Weapons.Rogue
{
if (player.Calamity().StealthStrikeAvailable())
{
int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 2f, damage);
int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 1f, damage);
if (p.WithinBounds(Main.maxProjectiles))
Main.projectile[p].Calamity().stealthStrike = true;
}
else
{
Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 1f, damage);
Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0.25f, damage);
}
return false;
}
@@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Summon
{
Item.width = 46;
Item.height = 46;
Item.damage = 55;
Item.damage = 67;
Item.mana = 10;
Item.useTime = Item.useAnimation = 20;
Item.useStyle = ItemUseStyleID.Swing;
@@ -753,6 +753,11 @@ HallowedRuneRegeneration: {
Description: Regenerating life
}
Haste: {
DisplayName: Haste
Description: Increased movement speed and acceleration
}
IceShieldBuff: {
DisplayName: Ice Shield
Description: Absorbs 20% damage from the next hit you take, then shatters
@@ -718,7 +718,11 @@ SlitheringEels: {
SnowstormStaff: {
DisplayName: Snowstorm Staff
Tooltip: Fires a snowflake that follows the mouse cursor
Tooltip:
'''
Fires snowflakes that follows the mouse cursor
Snowflakes split into ice stars on enemy hits
'''
}
SoulPiercer: {
@@ -249,6 +249,18 @@ CelestialClaymore: {
Tooltip: Spawns cosmic energy stars near the cursor that inflict several debuffs
}
ChronomancersScythe: {
DisplayName: Chronomancer's Scythe
Tooltip:
'''
Rapidly fires icicles
Press <right> to swing the scythe around you creating a clock pattern of homing icicles
Direct hits with the scythe have a chance to spawn clocks
Collecting the clocks increases movement speed and acceleration by 5% for each clock collected
This stacks up to 3 times and each level wears off after 5 seconds
'''
}
ClamCrusher: {
DisplayName: Clam Crusher
Tooltip:
@@ -391,9 +391,8 @@ Exorcism: {
DisplayName: Exorcism
Tooltip:
'''
Throws a hallowed cross which explodes into a flash of light that damages nearby enemies, closer enemies receiving more damage
As the cross travels downwards, the damage inflicted by both the cross and flash increases constantly
Stealth strikes cause the cross to be thrown with full damage immediately. Hallowed stars fall when the cross explodes
Throws a hallowed cross which explodes into a flash of light that damages nearby enemies
Stealth strikes create larger flashes and rain stars infused with holy light
'''
}
@@ -22,6 +22,11 @@ RecipeGroup: {
WikiStatus1: "[i:Book] [c/EE4939:Note: The Fandom wiki is no longer supported by Calamity.] [i:Book]"
WikiStatus2: "[i:Book] [c/EE4939:Check out the Official Calamity Mod Wiki at ][c/3989FF:calamitymod.wiki.gg][c/EE4939:!] [i:Book]"
MusicModReminder: "[i:MusicBoxMartians] [c/71DFF5:Remember to also install the Calamity Music Mod to experience our soundtrack!] [i:MusicBoxMartians]"
GimmeSwagPlushieCampaign:
'''
[i:GreenPresent] [c/3BE022:LIMITED TIME! Sign up for the Calamitas Plushie Campaign!] [c/3989FF:calamitymod.com/plush] [i:GreenPresent]
'''
// Recipe Conditions
Tier1ArsenalRecipeCondition: View an unencrypted schematic from the lab near the Sunken Sea
Tier2ArsenalRecipeCondition: Decrypt a schematic from the lab in the large planetoid in the sky
@@ -200,6 +200,7 @@ SlitheringEelProjectile.DisplayName: Slithering Eel
SmallSpirit.DisplayName: Small Angry Spirit
Snowball.DisplayName: Snowball
Snowflake.DisplayName: Snowflake
SnowflakeIceStar.DisplayName: Ice Star
SolarElementalBeam.DisplayName: Solar Beam
SoulPiercerBeam.DisplayName: Soul Piercer
SoulPiercerBolt.DisplayName: Soul Piercer
@@ -56,6 +56,9 @@ BrokenBiomeBladeHoldout.DisplayName: Broken Biome Blade
BurningMeteor.DisplayName: Meteor
CatastropheClaymoreSparkle.DisplayName: Catastrophe Sparkle
ChainedMeatHook.DisplayName: Enchanted Meat Hook
ChronoIcicleLarge.DisplayName: Chrono Icicle
ChronoIcicleSmall.DisplayName: Chrono Icicle
ChronomancersScytheHoldout.DisplayName: Chronomancer's Scythe
ClamCrusherFlail.DisplayName: Clam Crusher
CometQuasherMeteor.DisplayName: Comet Quasher Meteor
CosmicBolt.DisplayName: Cosmic Bolt
@@ -30,6 +30,7 @@ BossRushTierAnimation.DisplayName: Boss Rush Tier Animation
BrimstoneHellfireballFriendly2.DisplayName: Hellfire
ChaoticGeyser.DisplayName: Chaotic Geyser
ChlorophyteLifePulse.DisplayName: Life Pulse
ChronoClock.DisplayName: Chrono Clock
CoralBubble.DisplayName: Bubble
CoralBubbleSmall.DisplayName: Bubble
CryonicShield.DisplayName: Cryonic Shield
@@ -1,4 +1,6 @@
using CalamityMod.CalPlayer;
using System;
using CalamityMod.CalPlayer;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
@@ -73,6 +75,38 @@ namespace CalamityMod.Projectiles.BaseProjectiles
/// </summary>
public virtual bool PreventTargettingUntilTargetHit => true;
/// <summary>
/// If <see langword="true"/>, the minion will be considered grounded, this will turn on some features that are neccesary for grounded minions.<br/>
/// Defaults to <see langword="false"/>.
/// </summary>
public virtual bool Grounded => false;
/// <summary>
/// The speed at which the minion falls.<br/>
/// It'll take the absolute value of whatever you input, to ensure that it's on Terraria's coordinate system.<br/>
/// This is intended to use for grounded minions.<br/>
/// Defaults to 0.4f.
/// </summary>
public float Gravity
{
get => _gravity;
set => _gravity = MathF.Abs(value);
}
private float _gravity = 0.4f;
/// <summary>
/// The max speed at which the minion falls.<br/>
/// It'll take the absolute value of whatever you input, to ensure that it's on Terraria's coordinate system.<br/>
/// This is intended to use for grounded minions.<br/>
/// Defaults to 20f.
/// </summary>
public float MaxGravity
{
get => _maxGravity;
set => _maxGravity = MathF.Abs(value);
}
private float _maxGravity = 20f;
/// <summary>
/// The amount of animation frames this minion has.<br/>
/// Defaults to 1 frame.
@@ -119,7 +153,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles
Projectile.penetrate = -1;
Projectile.friendly = true;
Projectile.tileCollide = false;
Projectile.tileCollide = Grounded;
Projectile.ignoreWater = true;
Projectile.minion = true;
Projectile.usesLocalNPCImmunity = true;
@@ -135,12 +169,14 @@ namespace CalamityMod.Projectiles.BaseProjectiles
public override void AI()
{
Projectile.localNPCHitCooldown = IFrames * Projectile.MaxUpdates;
SetOwnerTarget();
CheckMinionExistence();
SetOwnerTarget();
DoAnimation();
MinionAI();
}
public override bool OnTileCollide(Vector2 oldVelocity) => false;
#region AI Methods
/// <summary>
@@ -189,6 +225,149 @@ namespace CalamityMod.Projectiles.BaseProjectiles
Owner = Main.player[Projectile.owner];
ModdedOwner = Owner.Calamity();
Target = Owner.Center.MinionHoming(AdaptiveEnemyDistanceDetection, Owner, !PreHardmodeMinionTileVision || CalamityPlayer.areThereAnyDamnBosses);
// When minions are grounded, they are affected by tiles, meaning they have a much limited movement.
// Pre-Hardmode minions are affected the most since they can't see through walls.
// In consequence, some targets that may seem valid, aren't detected due to this.
// If the minion hasn't detected any targets with the center being the player, we give them a second chance with the center being the minion itself.
// If there are bosses on the world, we don't do this check because if there wasn't any targets with tile X-Ray, this won't do anything.
if (Grounded && Target is null && PreHardmodeMinionTileVision && !CalamityPlayer.areThereAnyDamnBosses)
Target = Projectile.Center.MinionHoming(AdaptiveEnemyDistanceDetection, Owner, false);
}
#endregion
#region Grounded Minion Utilities
/// <summary>
/// A quick method to apply gravity to grounded minions.<br/>
/// You can choose to not use it and make your own if a simple one does not fit your need.
/// </summary>
public void DoGravity()
{
float speedY = Projectile.velocity.Y;
if (speedY < _maxGravity)
speedY = MathF.Min(speedY + _gravity, _maxGravity);
Projectile.velocity.Y = speedY;
}
/// <summary>
/// Checks whether there's a tile between two vectors vertically.<br/>
/// This method has many shorthand variants.<br/>
/// Useful for grounded minion behavior.
/// </summary>
/// <param name="startVector">The starter vector. Its X component will be the one used, so put here the vector from where you want to check.</param>
/// <param name="endVector">The ending vector.</param>
/// <param name="platformCheckDownwards">Whether you want to check for platforms when <paramref name="endVector"/> is below <paramref name="startVector"/></param>
/// <returns>Returns <see langword="true"/> if there's a tile between <paramref name="startVector"/> and <paramref name="endVector"/>, the X coordinate being the one from <paramref name="startVector"/>; otherwise <see langword="false"/>.</returns>
public bool IsTileBetweenTwoVectorsVertically(Vector2 startVector, Vector2 endVector, bool platformCheckDownwards = false)
{
Point startPoint = CalamityUtils.ToSafeTileCoordinates(startVector);
Point endPoint = CalamityUtils.ToSafeTileCoordinates(endVector);
if (endVector.Y > startVector.Y)
{
for (int coordY = endPoint.Y; coordY >= startPoint.Y; coordY--)
{
if (Main.tile[startPoint.X, coordY].IsTileSolidGround())
return true;
}
}
else
{
for (int coordY = endPoint.Y; coordY <= startPoint.Y; coordY++)
{
if (platformCheckDownwards)
{
if (Main.tile[startPoint.X, coordY].IsTileSolidGround())
return true;
}
else if (Main.tile[startPoint.X, coordY].IsTileSolid())
return true;
}
}
return false;
}
public bool IsTileBetweenOwnerAndVectorVertically(Vector2 vector, bool platformCheckDownwards = false) => IsTileBetweenTwoVectorsVertically(Owner.Center, vector, platformCheckDownwards);
public bool IsTileBetweenTargetAndVectorVertically(Vector2 vector, bool platformCheckDownwards = false) => IsTileBetweenTwoVectorsVertically(Target.Center, vector, platformCheckDownwards);
public bool IsTileBetweenVectorAndMinionVertically(Vector2 vector, bool platformCheckDownwards = false) => IsTileBetweenTwoVectorsVertically(vector, Projectile.Center, platformCheckDownwards);
public bool IsTileBetweenOwnerAndMinionVertically(bool platformCheckDownwards = false) => IsTileBetweenTwoVectorsVertically(Owner.Center, Projectile.Center, platformCheckDownwards);
public bool IsTileBetweenTargetAndMinionVertically(bool platformCheckDownwards = false) => IsTileBetweenTwoVectorsVertically(Target.Center, Projectile.Center, platformCheckDownwards);
/// <summary>
/// Checks if the minion has a tile in front of him, at their left or right.
/// </summary>
/// <param name="leftFluff">The extra distance it'll check at the left, not all minions are perfectly sized 1 tile, so you'll need to tweak this. Defaults to 0.</param>
/// <param name="rightFluff">The extra distance it'll check at the right, not all minions are perfectly sized 1 tile, so you'll need to tweak this. Defaults to 0.</param>
/// <returns><see langword="true"/> if there's a tile at the left or right, otherwise <see langword="false"/></returns>
public bool IsMinionFacingTile(int leftFluff = 0, int rightFluff = 0)
{
Point topLeft = CalamityUtils.ToSafeTileCoordinates(Projectile.TopLeft);
Point bottomLeft = CalamityUtils.ToSafeTileCoordinates(Projectile.BottomLeft);
for (int coordY = topLeft.Y; coordY < bottomLeft.Y; coordY++)
{
if (Main.tile[topLeft.X - leftFluff, coordY].IsTileSolid())
return true;
}
Point topRight = CalamityUtils.ToSafeTileCoordinates(Projectile.TopRight);
Point bottomRight = CalamityUtils.ToSafeTileCoordinates(Projectile.BottomRight);
for (int coordY = topRight.Y; coordY <= bottomRight.Y; coordY++)
{
if (Main.tile[topRight.X + rightFluff, coordY].IsTileSolid())
return true;
}
return false;
}
/// <summary>
/// Checks whether the minion is standing on a tile or not.
/// </summary>
/// <returns><see langword="true"/> if the minion's standing on a tile, otherwise <see langword="false"/></returns>
public bool IsMinionStandingOnTile()
{
Point minionPointLeft = CalamityUtils.ToSafeTileCoordinates(Projectile.BottomLeft);
Point minionPointRight = CalamityUtils.ToSafeTileCoordinates(Projectile.BottomRight);
for (int coordX = minionPointLeft.X; coordX <= minionPointRight.X; coordX++)
{
if (Main.tile[coordX, minionPointLeft.Y].IsTileSolidGround())
return true;
}
return false;
}
/// <summary>
/// Checks whether the minion is inside a tile or not.<br/>
/// It checks if there's tiles in the diagonals of the minion's hitbox.
/// </summary>
/// <returns><see langword="true"/> if there's a tile inside the minion, otherwise <see langword="false"/></returns>
public bool IsMinionInsideTile()
{
Point topLeft = CalamityUtils.ToSafeTileCoordinates(Projectile.TopLeft);
Point bottomRight = CalamityUtils.ToSafeTileCoordinates(Projectile.BottomRight);
for (int coordX = topLeft.X; coordX <= bottomRight.X; coordX++)
{
if (Main.tile[coordX, (int)Utils.Remap(coordX, topLeft.X, bottomRight.X, topLeft.Y, bottomRight.Y)].IsTileSolid())
return true;
}
Point topRight = CalamityUtils.ToSafeTileCoordinates(Projectile.TopRight);
Point bottomLeft = CalamityUtils.ToSafeTileCoordinates(Projectile.BottomLeft);
for (int coordX = bottomLeft.X; coordX >= topRight.X; coordX--)
{
if (Main.tile[coordX, (int)Utils.Remap(coordX, bottomLeft.X, topRight.X, bottomLeft.Y, bottomRight.Y)].IsTileSolid())
return true;
}
return false;
}
#endregion
+3 -5
View File
@@ -25,6 +25,8 @@ namespace CalamityMod.Projectiles.Magic
Projectile.ignoreWater = true;
Projectile.penetrate = 5;
Projectile.timeLeft = 420;
Projectile.usesIDStaticNPCImmunity = true;
Projectile.idStaticNPCHitCooldown = 7;
}
public override void AI()
@@ -88,10 +90,6 @@ namespace CalamityMod.Projectiles.Magic
return false;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.immune[Projectile.owner] = 7;
target.AddBuff(BuffID.Confused, 300);
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Confused, 300);
}
}
+2 -5
View File
@@ -19,6 +19,8 @@ namespace CalamityMod.Projectiles.Magic
Projectile.penetrate = 5;
Projectile.MaxUpdates = 3;
Projectile.DamageType = DamageClass.Magic;
Projectile.usesIDStaticNPCImmunity = true;
Projectile.idStaticNPCHitCooldown = 5;
}
public override void AI()
@@ -89,10 +91,5 @@ namespace CalamityMod.Projectiles.Magic
}
}
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.immune[Projectile.owner] = 5;
}
}
}
+3 -6
View File
@@ -1,4 +1,4 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ModLoader;
@@ -18,6 +18,8 @@ namespace CalamityMod.Projectiles.Magic
Projectile.penetrate = 5;
Projectile.MaxUpdates = 3;
Projectile.DamageType = DamageClass.Magic;
Projectile.usesIDStaticNPCImmunity = true;
Projectile.idStaticNPCHitCooldown = 5;
}
public override void AI()
@@ -88,10 +90,5 @@ namespace CalamityMod.Projectiles.Magic
}
}
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.immune[Projectile.owner] = 5;
}
}
}
+149 -4
View File
@@ -3,6 +3,8 @@ using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Audio;
using System;
using CalamityMod.Items.Weapons.Magic;
namespace CalamityMod.Projectiles.Magic
{
@@ -19,24 +21,147 @@ namespace CalamityMod.Projectiles.Magic
{
Projectile.width = 20;
Projectile.height = 20;
Projectile.aiStyle = ProjAIStyleID.MagicMissile;
Projectile.friendly = true;
Projectile.tileCollide = false;
Projectile.alpha = 70;
Projectile.penetrate = -1;
Projectile.timeLeft = 600;
Projectile.DamageType = DamageClass.Magic;
AIType = ProjectileID.FlyingKnife;
Projectile.coldDamage = true;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 10;
}
public override void AI()
{
Projectile.rotation += 0.15f;
Player player = Main.player[Projectile.owner];
if (player == null)
return;
if (!(player.channel && !player.noItems && !player.CCed))
Projectile.Kill();
if (Projectile.type != ModContent.ProjectileType<Snowflake>() ||
Main.player[Projectile.owner].HeldItem.type != ModContent.ItemType<SnowstormStaff>() || !Main.player[Projectile.owner].channel)
{
Projectile.Kill();
return;
}
if (Projectile.ai[2] > 0)
{
Projectile.ai[2]--;
}
// 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;
Projectile.rotation += 0.2f;
if (Projectile.localAI[0] < 1f)
{
Projectile.localAI[0] += 0.002f;
}
else
{
Projectile.width = Projectile.height = 50;
}
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;
}
}
if (Main.rand.NextBool(5))
{
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 67, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f);
}
float pushForce = 0.15f;
for (int k = 0; k < Main.maxProjectiles; k++)
{
Projectile otherProj = Main.projectile[k];
// Short circuits to make the loop as fast as possible.
if (!otherProj.active || k == Projectile.whoAmI)
continue;
// If the other projectile is indeed the same owned by the same player and they're too close, nudge them away.
bool sameProjType = otherProj.type == Projectile.type;
float taxicabDist = Vector2.Distance(Projectile.Center, otherProj.Center);
float distancegate = 100f;
if (sameProjType && taxicabDist < distancegate)
{
if (Projectile.position.X < otherProj.position.X)
Projectile.velocity.X -= pushForce;
else
Projectile.velocity.X += pushForce;
if (Projectile.position.Y < otherProj.position.Y)
Projectile.velocity.Y -= pushForce;
else
Projectile.velocity.Y += pushForce;
}
}
}
public override bool PreDraw(ref Color lightColor)
@@ -52,12 +177,32 @@ namespace CalamityMod.Projectiles.Magic
{
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 67, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f);
}
if (Projectile.owner == Main.myPlayer)
{
for (int x = 1; x <= 2; x++)
{
Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, Projectile.velocity * 0.5f + Main.rand.NextVector2Square(-4, 4), Mod.Find<ModGore>("CryoShieldGore" + Main.rand.Next(1, 5)).Type, 0.7f);
}
}
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.immune[Projectile.owner] = 7;
target.AddBuff(BuffID.Frostburn2, 180);
float randOffset = Main.rand.NextFloat(0, 2 * MathHelper.Pi);
// spawn mini stars on hit with a 5 second cooldown
if (Projectile.owner == Main.myPlayer && Projectile.ai[2] <= 0)
{
for (int i = 0; i < 3; i++)
{
Vector2 velocity = (MathHelper.TwoPi * i / 3f + randOffset).ToRotationVector2() * 4f;
int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType<SnowflakeIceStar>(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner);
Main.projectile[p].DamageType = DamageClass.Magic;
}
SoundEngine.PlaySound(SoundID.Item30, Projectile.Center);
// set the 5 second cooldown
Projectile.ai[2] = 300;
}
}
}
}
+85
View File
@@ -0,0 +1,85 @@
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Audio;
namespace CalamityMod.Projectiles.Magic
{
public class SnowflakeIceStar : ModProjectile, ILocalizedModType
{
public override string Texture => "CalamityMod/Projectiles/Typeless/KelvinCatalystStar";
public new string LocalizationCategory => "Projectiles.Magic";
public override void SetStaticDefaults()
{
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4;
ProjectileID.Sets.TrailingMode[Projectile.type] = 0;
}
public override void SetDefaults()
{
Projectile.width = 16;
Projectile.height = 16;
Projectile.friendly = true;
Projectile.penetrate = 1;
Projectile.tileCollide = false;
Projectile.DamageType = DamageClass.Magic;
Projectile.coldDamage = true;
}
public override void AI()
{
if (Projectile.ai[0] < 90f)
{
Projectile.ai[0] += 1f;
Projectile.velocity.X *= 0.98f;
Projectile.velocity.Y *= 0.98f;
}
else
{
CalamityUtils.HomeInOnNPC(Projectile, true, 500f, 12f, 20f);
}
Lighting.AddLight(Projectile.Center, Main.DiscoR * 0.075f / 255f, Main.DiscoR * 0.1f / 255f, Main.DiscoR * 0.125f / 255f);
if (Main.rand.NextBool(6))
{
int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 100, default, 0.4f);
Main.dust[dust].velocity *= 0.3f;
Main.dust[dust].noGravity = true;
}
Projectile.rotation += 0.25f;
}
public override bool? CanDamage()
{
return Projectile.ai[0] >= 90f ? null : false;
}
public override bool PreDraw(ref Color lightColor)
{
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1);
return false;
}
public override void OnKill(int timeLeft)
{
SoundEngine.PlaySound(SoundID.Item27, Projectile.position);
Projectile.ExpandHitboxBy(24);
int dustAmt = 36;
for (int j = 0; j < dustAmt; j++)
{
Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f;
rotate = rotate.RotatedBy((double)((float)(j - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default) + Projectile.Center;
Vector2 faceDirection = rotate - Projectile.Center;
int icyDust = Dust.NewDust(rotate + faceDirection, 0, 0, 67, faceDirection.X * 0.5f, faceDirection.Y * 0.5f, 100, default, 0.75f);
Main.dust[icyDust].noGravity = true;
}
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Frostburn2, 60);
public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Frostburn2, 60);
}
}
+145
View File
@@ -0,0 +1,145 @@
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Audio;
using CalamityMod.Buffs.StatDebuffs;
using System.Security.Policy;
using System;
using System.Diagnostics.Metrics;
namespace CalamityMod.Projectiles.Melee
{
public class ChronoIcicleLarge : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Melee";
public static int HomingSpeed = 16;
public static int IdleSpeedMax = 7;
public override void SetDefaults()
{
Projectile.width = 12;
Projectile.height = 12;
Projectile.aiStyle = -1;
Projectile.coldDamage = true;
Projectile.friendly = true;
Projectile.penetrate = 1;
Projectile.DamageType = DamageClass.Melee;
Projectile.coldDamage = true;
Projectile.tileCollide = false;
Projectile.timeLeft = 180;
}
public override void AI()
{
Projectile.ai[1]++;
switch (Projectile.ai[0])
{
// stay in an evenly spaced circle around the player, resembling the 12 ticks on a clock
case 0:
if (Projectile.velocity.Length() > 0.01f)
{
Projectile.velocity *= 0.001f;
}
bool isCounter = Projectile.ai[2] < 0;
if (Main.player[Projectile.owner].active && !Main.player[Projectile.owner].dead)
{
float shardNum = Math.Abs(Projectile.ai[2]) - 1;
float aivar = isCounter ? 1 - shardNum - 1 : shardNum;
Projectile.position = Main.player[Projectile.owner].Center + (2 * MathHelper.Pi / 12 * aivar - MathHelper.PiOver2).ToRotationVector2() * 160 - Projectile.Size / 2;
}
if (Projectile.ai[1] >= (12 - Math.Abs(Projectile.ai[2])) * 5 + 2)
{
SoundEngine.PlaySound(SoundID.NPCHit5, Projectile.Center);
for (int i = 0; i < 10; i++)
{
int dusttype = Main.rand.NextBool() ? 68 : 67;
if (Main.rand.NextBool(4))
{
dusttype = 80;
}
Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f));
int dust = Dust.NewDust(Projectile.Center, 1, 1, dusttype, dspeed.X, dspeed.Y, 50, default, 1.1f);
Main.dust[dust].noGravity = true;
}
Projectile.ai[0] = 1;
Projectile.ai[1] = 0;
}
break;
// jet out
case 1:
if (Projectile.velocity.Length() < IdleSpeedMax)
{
Projectile.velocity *= 3f;
}
if (Projectile.ai[1] > 20)
{
Projectile.ai[0] = 2;
}
break;
// home if possible
case 2:
// Set amount of extra updates.
if (Projectile.Calamity().defExtraUpdates == -1)
Projectile.Calamity().defExtraUpdates = Projectile.extraUpdates;
Vector2 destination = Projectile.Center;
float maxDistance = 1400;
bool locatedTarget = false;
// Find a target.
for (int i = 0; i < Main.maxNPCs; i++)
{
float extraDistance = (Main.npc[i].width / 2) + (Main.npc[i].height / 2);
if (!Main.npc[i].CanBeChasedBy(Projectile, false) || !Projectile.WithinRange(Main.npc[i].Center, maxDistance + extraDistance))
continue;
destination = Main.npc[i].Center;
locatedTarget = true;
break;
}
if (locatedTarget)
{
// Increase amount of extra updates to greatly increase homing velocity.
Projectile.extraUpdates = Projectile.Calamity().defExtraUpdates + 1;
// Home in on the target.
Vector2 homeDirection = (destination - Projectile.Center).SafeNormalize(Vector2.UnitY);
Projectile.velocity = (Projectile.velocity * 0.2f + homeDirection * HomingSpeed) / (0.2f + 1f);
}
else
{
// Set amount of extra updates to default amount.
Projectile.extraUpdates = Projectile.Calamity().defExtraUpdates;
if (Projectile.velocity.Length() < IdleSpeedMax)
{
Projectile.velocity *= 3f;
}
}
break;
}
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
SoundEngine.PlaySound(SoundID.Item27, Projectile.position);
target.AddBuff(ModContent.BuffType<TimeDistortion>(), 60);
}
public override void OnKill(int timeLeft)
{
for (int index1 = 0; index1 < 3; ++index1)
{
int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 76);
Main.dust[index2].noGravity = true;
Main.dust[index2].noLight = true;
Main.dust[index2].scale = 0.7f;
}
}
public override bool? CanHitNPC(NPC target)
{
// the icicles cannot hit while glued to the player
return Projectile.ai[0] > 0;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 843 B

+47
View File
@@ -0,0 +1,47 @@
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Audio;
using CalamityMod.Buffs.StatDebuffs;
namespace CalamityMod.Projectiles.Melee
{
public class ChronoIcicleSmall : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Melee";
public override void SetDefaults()
{
Projectile.width = 12;
Projectile.height = 12;
Projectile.aiStyle = ProjAIStyleID.Arrow;
Projectile.coldDamage = true;
Projectile.friendly = true;
Projectile.penetrate = 1;
Projectile.DamageType = DamageClass.Melee;
Projectile.coldDamage = true;
}
public override void AI()
{
Projectile.velocity.Y += 0.05f;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
SoundEngine.PlaySound(SoundID.Item27 with { Volume = SoundID.Item12.Volume * 0.7f }, Projectile.position);
target.AddBuff(ModContent.BuffType<TimeDistortion>(), 30);
}
public override void OnKill(int timeLeft)
{
for (int index1 = 0; index1 < 3; ++index1)
{
int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 76);
Main.dust[index2].noGravity = true;
Main.dust[index2].noLight = true;
Main.dust[index2].scale = 0.7f;
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 397 B

@@ -0,0 +1,121 @@
using System;
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.Particles;
using CalamityMod.Projectiles.Typeless;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Melee
{
public class ChronomancersScytheHoldout : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Melee";
public Player Owner => Main.player[Projectile.owner];
public override string Texture => "CalamityMod/Items/Weapons/Melee/ChronomancersScythe";
public static int ClockChance = 30;
public override void SetDefaults()
{
Projectile.width = 60;
Projectile.height = 60;
Projectile.friendly = true;
Projectile.DamageType = TrueMeleeNoSpeedDamageClass.Instance;
Projectile.ignoreWater = true;
Projectile.tileCollide = false;
Projectile.penetrate = -1;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 10;
Projectile.ownerHitCheck = true;
}
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
float collisionPoint = 0f;
float bladeLength = 130 * Projectile.scale;
float bladeWidth = 90 * Projectile.scale;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (Projectile.rotation.ToRotationVector2() * bladeLength), bladeWidth, ref collisionPoint);
}
public override void AI()
{
Owner.ChangeDir((int)Projectile.ai[2]);
Projectile.velocity = Vector2.Zero;
Projectile.rotation += (2 * MathHelper.Pi / 60) * Projectile.ai[2];
UpdateOwnerVars();
Projectile.Center = Owner.MountedCenter + Projectile.rotation.ToRotationVector2() * 10f - Vector2.UnitX * 4 * Owner.direction;
// once the scythe has completed a rotation, die
if ((Projectile.rotation > 2 * MathHelper.Pi - MathHelper.PiOver2 + MathHelper.PiOver4 && Projectile.ai[2] == 1) || (Projectile.rotation < -(2 * MathHelper.Pi - MathHelper.PiOver2 + MathHelper.PiOver4) && Projectile.ai[2] == -1))
{
Projectile.Kill();
}
// spawn 12 clock hand icicles
Projectile.ai[0]++;
float HandInterval = 60 / 12;
if (Projectile.ai[0] >= HandInterval)
{
if (Projectile.owner == Main.myPlayer)
{
// Math is beautiful
float aivar = Projectile.ai[2] == -1 ? 1 - Projectile.ai[1] - 1 : Projectile.ai[1];
Vector2 spawnPos = Main.player[Projectile.owner].Center + (2 * MathHelper.Pi / 12 * aivar - MathHelper.PiOver2).ToRotationVector2() * 160;
Vector2 rotationVector = spawnPos - Main.player[Projectile.owner].Center;
int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnPos, rotationVector * 5, ModContent.ProjectileType<ChronoIcicleLarge>(), Projectile.damage, Projectile.knockBack, Projectile.owner, ai2: Projectile.ai[2] * (Projectile.ai[1] + 1));
Main.projectile[p].rotation = (spawnPos - Main.player[Projectile.owner].Center).ToRotation() + MathHelper.PiOver2;
}
Projectile.ai[1]++;
Projectile.ai[0] = 0;
}
}
public void UpdateOwnerVars()
{
float rotOffset = Projectile.ai[2] == -1 ? 3 * MathHelper.Pi : MathHelper.PiOver2;
Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, Projectile.rotation - rotOffset);
Owner.heldProj = Projectile.whoAmI;
Owner.itemTime = 2;
Owner.itemAnimation = 2;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(ModContent.BuffType<TimeDistortion>(), 60);
if (Main.rand.NextBool(ClockChance))
{
Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Main.rand.NextVector2Circular(-2, 2), ModContent.ProjectileType<ChronoClock>(), 0, 0, Projectile.owner);
}
}
//If we don't do that, the hit enemies get knocked back towards you if you hit them from the right??
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
// This would knock enemies away consistently, but i'm choosing to go with the other option
//hitDirection = Math.Sign(target.Center.X - Owner.Center.X);
//Doing it this way lets the player choose if they want to knockback enemies towards them by pointing away from them
modifiers.HitDirectionOverride = Owner.direction;
}
public override bool PreDraw(ref Color lightColor)
{
Owner.ChangeDir((int)Projectile.ai[2]);
Texture2D scytheTexture = ModContent.Request<Texture2D>(Texture).Value;
Vector2 handleOrigin = Projectile.ai[2] == -1 ? new Vector2(scytheTexture.Width, scytheTexture.Height) : new Vector2(0, scytheTexture.Height);
float scytheRotation = Projectile.rotation;
Main.EntitySpriteDraw(scytheTexture, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), scytheRotation, handleOrigin, Projectile.scale, Projectile.ai[2] == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0);
return false;
}
}
}
@@ -0,0 +1,130 @@
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.Items.Weapons.Melee;
using CalamityMod.Projectiles.Typeless;
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Melee
{
public class ChronomancersScytheSwing : ModProjectile
{
public override LocalizedText DisplayName => CalamityUtils.GetItemName<ChronomancersScythe>();
public static int IcicleSpeed = 24;
public static int IcicleVariance = 4;
public static int IcicleFrequency = 5;
public static float IcicleDamageMultiplier = 0.3f;
public static int ClockChance = 30;
public override void SetStaticDefaults()
{
Main.projFrames[Projectile.type] = 6;
}
public override void SetDefaults()
{
Projectile.width = 148;
Projectile.height = 68;
Projectile.friendly = true;
Projectile.penetrate = -1;
Projectile.tileCollide = false;
Projectile.DamageType = TrueMeleeNoSpeedDamageClass.Instance;
Projectile.ownerHitCheck = true;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 5;
Projectile.coldDamage = true;
}
public override void AI()
{
Player Owner = Main.player[Projectile.owner];
Projectile.damage = (int)(Owner.GetTotalDamage(Projectile.DamageType).ApplyTo(Projectile.originalDamage) * (1f + Utils.GetLerpValue(0f, 300f, Projectile.ai[1], true)));
Projectile.frameCounter++;
if (Projectile.frameCounter >= 1)
{
Projectile.frame++;
Projectile.frameCounter = 0;
}
if (Projectile.frame >= Main.projFrames[Projectile.type])
Projectile.frame = 0;
Projectile.soundDelay--;
if (Projectile.soundDelay <= 0)
{
SoundEngine.PlaySound(SoundID.Item71, Projectile.Center);
Projectile.soundDelay = 24;
}
if (Main.myPlayer == Projectile.owner)
{
if (Owner.channel && !Owner.noItems && !Owner.CCed)
{
float scaleFactor6 = 1f;
if (Owner.ActiveItem().shoot == Projectile.type)
scaleFactor6 = Owner.ActiveItem().shootSpeed * Projectile.scale;
Vector2 slashDirection = Main.MouseWorld - Owner.RotatedRelativePoint(Owner.MountedCenter, true);
slashDirection.Normalize();
if (slashDirection.HasNaNs())
slashDirection = Vector2.UnitX * (float)Owner.direction;
slashDirection *= scaleFactor6;
if (slashDirection.X != Projectile.velocity.X || slashDirection.Y != Projectile.velocity.Y)
Projectile.netUpdate = true;
Projectile.velocity = slashDirection;
}
else
Projectile.Kill();
}
Projectile.ai[0]++;
// rapidly fire icicles
if (Projectile.ai[0] % IcicleFrequency == 0)
{
if (Main.myPlayer == Projectile.owner)
{
Vector2 velocity = Projectile.Center.DirectionTo(Main.MouseWorld) * IcicleSpeed + new Vector2(Main.rand.NextFloat(-IcicleVariance, IcicleVariance), Main.rand.NextFloat(-IcicleVariance, IcicleVariance));
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType<ChronoIcicleSmall>(), (int)(Projectile.damage * IcicleDamageMultiplier), Projectile.knockBack, Projectile.owner);
}
}
Vector2 dustSpawn = Projectile.Center + Projectile.velocity * 3f;
Lighting.AddLight(dustSpawn, Color.LightBlue.R * 0.001f, Color.LightBlue.G * 0.001f, Color.LightBlue.B * 0.001f);
if (Main.rand.NextBool(3))
{
int dust = Dust.NewDust(dustSpawn - Projectile.Size * 0.5f, Projectile.width, Projectile.height, DustID.IceRod, Projectile.velocity.X, Projectile.velocity.Y, 100);
Main.dust[dust].noGravity = true;
Main.dust[dust].position -= Projectile.velocity;
}
Projectile.position = Owner.RotatedRelativePoint(Owner.MountedCenter, true) - Projectile.Size * 0.5f + Vector2.UnitX * 8 + Vector2.UnitY * 4;
Projectile.rotation = Projectile.velocity.ToRotation();
if (Projectile.spriteDirection == 1)
Projectile.rotation += MathHelper.Pi;
Projectile.spriteDirection = Projectile.direction;
Projectile.timeLeft = 2;
Owner.ChangeDir(Projectile.direction);
Owner.heldProj = Projectile.whoAmI;
Owner.itemTime = 2;
Owner.itemAnimation = 2;
Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation();
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(ModContent.BuffType<TimeDistortion>(), 60);
if (Main.rand.NextBool(ClockChance))
{
Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Main.rand.NextVector2Circular(-2, 2), ModContent.ProjectileType<ChronoClock>(), 0, 0, Projectile.owner);
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

+3 -2
View File
@@ -1,4 +1,4 @@
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Projectiles.Healing;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
@@ -29,6 +29,8 @@ namespace CalamityMod.Projectiles.Melee
Projectile.timeLeft = 300;
Projectile.ignoreWater = true;
AIType = ProjectileID.DeathSickle;
Projectile.usesIDStaticNPCImmunity = true;
Projectile.idStaticNPCHitCooldown = 2;
}
public override void AI()
@@ -73,7 +75,6 @@ namespace CalamityMod.Projectiles.Melee
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.immune[Projectile.owner] = 2;
target.AddBuff(ModContent.BuffType<GodSlayerInferno>(), 180);
if (target.life <= 0)
{
+6 -16
View File
@@ -31,18 +31,6 @@ namespace CalamityMod.Projectiles.Rogue
Projectile.velocity.Y += 0.1f;
Projectile.rotation += 0.05f * Projectile.direction;
// Damage Scaling
if (Projectile.velocity.Y > 0 && Projectile.ai[0] < 2f)
{
Projectile.ai[0] += 0.015f;
}
if (Projectile.ai[0] > 2f)
{
Projectile.ai[0] = 2f;
}
Projectile.damage = (int)(Projectile.ai[1] * Projectile.ai[0]);
// Dust Effects
Vector2 dustLeft = (new Vector2(-1, 0)).RotatedBy(Projectile.rotation);
Vector2 dustRight = (new Vector2(1, 0)).RotatedBy(Projectile.rotation);
@@ -55,7 +43,7 @@ namespace CalamityMod.Projectiles.Rogue
float maxScale = 1.4f;
int dustType = 175;
int dustCount = (int)(5 * (Projectile.ai[0] - 1f));
int dustCount = (int)(5 * (Projectile.ai[0]));
for (int i = 0; i < dustCount; i++)
{
@@ -105,17 +93,19 @@ namespace CalamityMod.Projectiles.Rogue
//Crystal smash sound
SoundEngine.PlaySound(SoundID.Item27, Projectile.Center);
// Light burst
int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<ExorcismShockwave>(), Projectile.damage, 0, Projectile.owner, Projectile.ai[0] - 1f, 0);
int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<ExorcismShockwave>(), (int)(Projectile.damage * 0.8f), 0, Projectile.owner, Projectile.ai[0], 0);
Main.projectile[p].rotation = Projectile.rotation;
if (Projectile.Calamity().stealthStrike)
Main.projectile[p].Calamity().stealthStrike = true;
// Stars
if (Projectile.Calamity().stealthStrike)
{
for (int i = 0; i < 9; i++)
for (int i = 0; i < 6; i++)
{
Vector2 pos = new Vector2(Projectile.Center.X + (float)Projectile.width * 0.5f + (float)Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50));
float speedX = (Projectile.Center.X - pos.X) / 20f;
float speedY = (Projectile.Center.Y - pos.Y) / 20f;
Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos.X, pos.Y, speedX, speedY, ModContent.ProjectileType<ExorcismStar>(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner, Main.rand.NextFloat(-3f, 3f), 0f);
Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos.X, pos.Y, speedX, speedY, ModContent.ProjectileType<ExorcismStar>(), (int)(Projectile.damage * 0.75f), Projectile.knockBack * 0.5f, Projectile.owner, Main.rand.NextFloat(-3f, 3f), 0f);
}
}
}
+8 -27
View File
@@ -1,4 +1,4 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
@@ -9,12 +9,13 @@ namespace CalamityMod.Projectiles.Rogue
public new string LocalizationCategory => "Projectiles.Rogue";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public static float radius = 100;
public static float Radius = 100;
public static float RadiusStealth = 200;
public override void SetDefaults()
{
Projectile.width = (int)radius * 2;
Projectile.height = (int)radius * 2;
Projectile.width = (int)(Projectile.Calamity().stealthStrike ? RadiusStealth * 2 : Radius * 2);
Projectile.height = (int)(Projectile.Calamity().stealthStrike ? RadiusStealth * 2 : Radius * 2);
Projectile.friendly = true;
Projectile.penetrate = -1;
Projectile.tileCollide = false;
@@ -31,7 +32,7 @@ namespace CalamityMod.Projectiles.Rogue
{
Projectile.alpha = (int)((1 - Projectile.ai[0]) * 255f);
// Blast wave should be brighter the higher the charge of the projectile when it is killed
// Blast wave should be brighter on stealth strikes
int numDust = (int)(40 * Projectile.ai[0]) + 10;
for (int i = 0; i < numDust; i++)
@@ -55,7 +56,7 @@ namespace CalamityMod.Projectiles.Rogue
// Shockwave
Vector2 circleVelocity = new Vector2(Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1));
circleVelocity.Normalize();
circleVelocity *= radius / 10f;
circleVelocity *= (Projectile.Calamity().stealthStrike ? RadiusStealth : Radius) / 10f;
int circle = Dust.NewDust(Projectile.Center, 1, 1, dustType, circleVelocity.X, circleVelocity.Y, 0, default, 1.5f);
Main.dust[circle].noGravity = true;
@@ -117,26 +118,6 @@ namespace CalamityMod.Projectiles.Rogue
}
}
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
float dist1 = Vector2.Distance(Projectile.Center, target.Hitbox.TopLeft());
float dist2 = Vector2.Distance(Projectile.Center, target.Hitbox.TopRight());
float dist3 = Vector2.Distance(Projectile.Center, target.Hitbox.BottomLeft());
float dist4 = Vector2.Distance(Projectile.Center, target.Hitbox.BottomRight());
float damageScale = dist1;
if (dist2 < damageScale)
damageScale = dist2;
if (dist3 < damageScale)
damageScale = dist3;
if (dist4 < damageScale)
damageScale = dist4;
damageScale /= radius;
damageScale = 1f - damageScale;
modifiers.SourceDamage *= damageScale;
}
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox);
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, (Projectile.Calamity().stealthStrike ? RadiusStealth : Radius), targetHitbox);
}
}
+3 -2
View File
@@ -28,6 +28,7 @@ namespace CalamityMod.Projectiles.Rogue
Projectile.tileCollide = false;
Projectile.ignoreWater = true;
Projectile.timeLeft = 300;
Projectile.extraUpdates = 3;
Projectile.DamageType = RogueDamageClass.Instance;
}
@@ -42,9 +43,9 @@ namespace CalamityMod.Projectiles.Rogue
}
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType<HolyFlames>(), 180);
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType<HolyFlames>(), 60);
public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType<HolyFlames>(), 180);
public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType<HolyFlames>(), 60);
public override Color? GetAlpha(Color lightColor) => new Color(250, 200, 45, Projectile.alpha);
+3 -3
View File
@@ -1,4 +1,4 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ID;
@@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Rogue
Projectile.extraUpdates = 1;
Projectile.DamageType = RogueDamageClass.Instance;
Projectile.usesIDStaticNPCImmunity = true;
Projectile.idStaticNPCHitCooldown = 10;
Projectile.idStaticNPCHitCooldown = 15;
Projectile.timeLeft = 300;
Projectile.tileCollide = false;
}
@@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Rogue
if (Projectile.ai[0] == 0f)
{
Projectile.ai[1] += 1f;
if (Projectile.ai[1] >= 25f)
if (Projectile.ai[1] >= 30f)
{
Projectile.ai[0] = 1f;
Projectile.ai[1] = 0f;
+1
View File
@@ -55,6 +55,7 @@ namespace CalamityMod.Projectiles.Rogue
Projectile.penetrate = -1;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 10;
Projectile.damage /= 2;
Projectile.Damage();
SoundEngine.PlaySound(SoundID.NPCDeath37, Projectile.position);
if (Main.netMode != NetmodeID.Server)
-2
View File
@@ -45,8 +45,6 @@ namespace CalamityMod.Projectiles.Rogue
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
modifiers.SourceDamage *= 1.2f;
if (Main.rand.NextBool(10))
modifiers.SetCrit();
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
+5 -5
View File
@@ -194,10 +194,10 @@ namespace CalamityMod.Projectiles.Summon
// Projectile fire timer
if (Projectile.ai[1] > 0f)
Projectile.ai[1] += (float)Main.rand.Next(1, 3);
Projectile.ai[1] += (float)Main.rand.Next(1, 2+1);
// Reset timer
if (Projectile.ai[1] > 300f)
if (Projectile.ai[1] > 240f)
{
Projectile.ai[1] = 0f;
Projectile.netUpdate = true;
@@ -210,7 +210,7 @@ namespace CalamityMod.Projectiles.Summon
// Fire projectiles
if (Projectile.ai[0] == 0f)
{
float velocity = 8f;
float velocity = 10f;
int projectileType = ModContent.ProjectileType<SakuraBullet>();
if (canAttack && Projectile.ai[1] == 0f && Projectile.localAI[0] >= 120f)
{
@@ -223,10 +223,10 @@ namespace CalamityMod.Projectiles.Summon
projDirectionAgain *= velocity;
int numProj = 2;
float rotation = MathHelper.ToRadians(4);
for (int i = 0; i < numProj + 1; i++)
for (int i = 0; i < numProj; i++)
{
Vector2 perturbedSpeed = projDirectionAgain.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1)));
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, perturbedSpeed, projectileType, Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner, targetIndex, 0f);
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, perturbedSpeed, projectileType, (int)(Projectile.damage * 0.8f), Projectile.knockBack * 0.5f, Projectile.owner, targetIndex, 0f);
}
Projectile.netUpdate = true;
}
+3 -6
View File
@@ -34,6 +34,8 @@ namespace CalamityMod.Projectiles.Summon
Projectile.timeLeft *= 5;
Projectile.minion = true;
Projectile.DamageType = DamageClass.Summon;
Projectile.usesIDStaticNPCImmunity = true;
Projectile.idStaticNPCHitCooldown = 8;
}
public override void AI()
@@ -69,7 +71,7 @@ namespace CalamityMod.Projectiles.Summon
Projectile.frame = 0;
}
Lighting.AddLight(Projectile.Center, 0.3f, 0f, 0.5f);
Projectile.ChargingMinionAI(1200f, 1500f, 2400f, 150f, 0, 30f, 18f, 9f, new Vector2(0f, -60f), 30f, 12f, true, true);
Projectile.ChargingMinionAI(1200f, 1500f, 2400f, 150f, 0, 25f, 20f, 9f, new Vector2(0f, -60f), 30f, 15f, true, true);
bool isMinion = Projectile.type == ModContent.ProjectileType<PurpleButterfly>();
player.AddBuff(ModContent.BuffType<ResurrectionButterflyBuff>(), 3600);
if (isMinion)
@@ -94,10 +96,5 @@ namespace CalamityMod.Projectiles.Summon
Main.EntitySpriteDraw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)framing / 2f), Projectile.scale, spriteEffects, 0);
return false;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.immune[Projectile.owner] = 8;
}
}
}
+1 -1
View File
@@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Summon
Projectile.width = Projectile.height = 20;
Projectile.friendly = true;
Projectile.netImportant = true;
Projectile.timeLeft = 150;
Projectile.timeLeft = 210;
Projectile.extraUpdates = 1;
Projectile.tileCollide = false;
Projectile.DamageType = DamageClass.Summon;
+104
View File
@@ -0,0 +1,104 @@
using CalamityMod.Buffs.StatBuffs;
using CalamityMod.CalPlayer;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using System.IO;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Typeless
{
public class ChronoClock : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Typeless";
public override void SetStaticDefaults()
{
Main.projFrames[Projectile.type] = 8;
}
public override void SetDefaults()
{
Projectile.width = 28;
Projectile.height = 42;
Projectile.friendly = true;
Projectile.penetrate = -1;
Projectile.timeLeft = 600;
Projectile.tileCollide = false;
}
public override void AI()
{
Projectile.velocity *= 0.98f;
Player player = Main.player[Projectile.owner];
// if the player touches a clock, they get the Haste buff and their haste level increases to a maximum of 3
// this kills the clock
if (player.getRect().Intersects(Projectile.getRect()))
{
if (player.whoAmI == Main.myPlayer)
{
player.AddBuff(ModContent.BuffType<Haste>(), 60);
if (player.Calamity().hasteLevel < 3)
{
player.Calamity().hasteLevel++;
player.Calamity().hasteCounter = 0; // reset the haste countdown
SoundEngine.PlaySound(SoundID.DD2_DarkMageHealImpact with { Volume = 2 }, Projectile.Center);
for (int i = 0; i < 20; i++)
{
Particle sparkle = new SnowflakeSparkle(Projectile.Center, (Main.rand.NextVector2CircularEdge(100, 100)).SafeNormalize(Vector2.Zero) * 4, Color.LightBlue, Color.LightSkyBlue, Main.rand.NextFloat(0.1f, 0.6f), 60);
GeneralParticleHandler.SpawnParticle(sparkle);
}
}
else
{
// reset the haste countdown if haste level is maxed out
player.Calamity().hasteCounter = 0;
SoundEngine.PlaySound(SoundID.DD2_DarkMageHealImpact with { Volume = 0.2f, Pitch = 1.4f }, Projectile.Center);
for (int i = 0; i < 20; i++)
{
Particle sparkle = new SnowflakeSparkle(Projectile.Center, (Main.rand.NextVector2CircularEdge(100, 100)).SafeNormalize(Vector2.Zero) * 2, Color.LightBlue, Color.LightSkyBlue, Main.rand.NextFloat(0.04f, 0.3f), 30);
GeneralParticleHandler.SpawnParticle(sparkle);
}
}
Projectile.Kill();
}
}
Projectile.frameCounter++;
if (Projectile.frameCounter > 5)
{
Projectile.frame++;
Projectile.frameCounter = 0;
if (Projectile.frame % 2 == 0)
Projectile.netUpdate = true;
}
if (Projectile.frame > 7)
{
Projectile.frame = 0;
}
if (Main.rand.NextBool(5))
{
int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 76);
Main.dust[index2].noGravity = true;
Main.dust[index2].noLight = true;
Main.dust[index2].scale = 0.7f;
}
}
public override void OnKill(int timeLeft)
{
for (int index1 = 0; index1 < 3; ++index1)
{
int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 76);
Main.dust[index2].noGravity = true;
Main.dust[index2].noLight = true;
Main.dust[index2].scale = 0.7f;
}
}
public override bool? CanHitNPC(NPC target)
{
return false;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB