Merge branch 'master' into ark-line-makeup-session
No files matched your search
@@ -1,37 +0,0 @@
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.Projectiles.Summon;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Buffs.Summon
|
||||
{
|
||||
public class SquirrelSquireBuff : ModBuff
|
||||
{
|
||||
public override void SetDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Squirrel Squire");
|
||||
Description.SetDefault("The squirrel squire will protect you");
|
||||
Main.buffNoTimeDisplay[Type] = true;
|
||||
Main.buffNoSave[Type] = true;
|
||||
//Main.persistentBuff[Type] = true;
|
||||
}
|
||||
|
||||
public override void Update(Player player, ref int buffIndex)
|
||||
{
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
if (player.ownedProjectileCounts[ModContent.ProjectileType<SquirrelSquireMinion>()] > 0)
|
||||
{
|
||||
modPlayer.squirrel = true;
|
||||
}
|
||||
if (!modPlayer.squirrel)
|
||||
{
|
||||
player.DelBuff(buffIndex);
|
||||
buffIndex--;
|
||||
}
|
||||
else
|
||||
{
|
||||
player.buffTime[buffIndex] = 18000;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 693 B |
@@ -999,7 +999,6 @@ namespace CalamityMod.CalPlayer
|
||||
public bool aValkyrie = false;
|
||||
public bool apexShark = false;
|
||||
public bool gastricBelcher = false;
|
||||
public bool squirrel = false;
|
||||
public bool hauntedDishes = false;
|
||||
public bool stormjaw = false;
|
||||
public bool sGod = false;
|
||||
@@ -2026,7 +2025,6 @@ namespace CalamityMod.CalPlayer
|
||||
endoCooper = false;
|
||||
apexShark = false;
|
||||
gastricBelcher = false;
|
||||
squirrel = false;
|
||||
hauntedDishes = false;
|
||||
stormjaw = false;
|
||||
SPG = false;
|
||||
|
||||
@@ -22,7 +22,6 @@ namespace CalamityMod.Items.DifficultyItems
|
||||
|
||||
// Misc lines
|
||||
"Greatly nerfs the effectiveness of life steal.\n" +
|
||||
"Nerfs the effectiveness of the Titanium Armor set bonus, doesn't stack with Revengeance Mode.\n" +
|
||||
"The Nurse no longer heals you while a boss is alive.\n" +
|
||||
"Defense damage is 5% higher than Death Mode.\n" +
|
||||
"Increases damage done by 50% for several debuffs and all alcohols that reduce life regen.\n" +
|
||||
@@ -66,6 +65,9 @@ namespace CalamityMod.Items.DifficultyItems
|
||||
return false;
|
||||
}
|
||||
|
||||
// Can only be used in Revengeance mode.
|
||||
public override bool CanUseItem(Player player) => CalamityWorld.revenge;
|
||||
|
||||
public override bool UseItem(Player player)
|
||||
{
|
||||
// This world syncing code should only be run by one entity- the server, to prevent a race condition
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Projectiles.Magic;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Microsoft.Xna.Framework;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Magic
|
||||
{
|
||||
public class DemonicPitchfork : ModItem
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Demonic Pitchfork");
|
||||
Tooltip.SetDefault("Fires a demonic pitchfork");
|
||||
Item.staff[item.type] = true;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
item.damage = 82;
|
||||
item.magic = true;
|
||||
item.mana = 11;
|
||||
item.width = 52;
|
||||
item.height = 48;
|
||||
item.useTime = 24;
|
||||
item.useAnimation = 24;
|
||||
item.useStyle = ItemUseStyleID.HoldingOut;
|
||||
item.noMelee = true;
|
||||
item.knockBack = 6f;
|
||||
item.value = Item.buyPrice(0, 36, 0, 0);
|
||||
item.rare = ItemRarityID.Pink;
|
||||
item.UseSound = SoundID.Item20;
|
||||
item.autoReuse = true;
|
||||
item.shoot = ModContent.ProjectileType<DemonicPitchforkProj>();
|
||||
item.shootSpeed = 16f;
|
||||
}
|
||||
|
||||
public override Vector2? HoldoutOrigin()
|
||||
{
|
||||
return new Vector2(15, 15);
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
ModRecipe recipe = new ModRecipe(mod);
|
||||
recipe.AddIngredient(ItemID.Obsidian, 20);
|
||||
recipe.AddIngredient(ModContent.ItemType<TrueShadowScale>(), 15);
|
||||
recipe.AddIngredient(ItemID.HellstoneBar, 10);
|
||||
recipe.AddIngredient(ItemID.SoulofNight, 10);
|
||||
recipe.AddTile(TileID.Anvils);
|
||||
recipe.SetResult(this);
|
||||
recipe.AddRecipe();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1.1 KiB |
@@ -68,7 +68,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
|
||||
#endregion
|
||||
|
||||
public override string Texture => "CalamityMod/Items/Weapons/Melee/GalaxiaExtra"; //Just in case the player SOMEHOW gets to swing galaxia itself. Sprite also used as the base for other attacks
|
||||
public override string Texture => "CalamityMod/Items/Weapons/Melee/Galaxia"; //Base sprite for stuff like item browser and shit. yeah
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
@@ -175,7 +175,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
item.width = item.height = 108;
|
||||
item.width = item.height = 128;
|
||||
item.damage = 99;
|
||||
item.melee = true;
|
||||
item.useAnimation = 18;
|
||||
@@ -312,8 +312,22 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
if (mainAttunement == null)
|
||||
mainAttunement = Attunement.attunementArray[(int)AttunementID.Phoenix];
|
||||
|
||||
Texture2D itemTexture = GetTexture((mainAttunement.id == AttunementID.Polaris || mainAttunement.id == AttunementID.Andromeda) ? "CalamityMod/Items/Weapons/Melee/GalaxiaRed" : "CalamityMod/Items/Weapons/Melee/GalaxiaBlue");
|
||||
spriteBatch.Draw(itemTexture, position, null, Color.White, 0f, origin, scale, SpriteEffects.None, 0f);
|
||||
Texture2D itemTexture = GetTexture((mainAttunement.id == AttunementID.Polaris || mainAttunement.id == AttunementID.Andromeda) ? "CalamityMod/Items/Weapons/Melee/GalaxiaDusk" : "CalamityMod/Items/Weapons/Melee/GalaxiaDawn");
|
||||
Texture2D outlineTexture = GetTexture((mainAttunement.id == AttunementID.Polaris || mainAttunement.id == AttunementID.Andromeda) ? "CalamityMod/Items/Weapons/Melee/GalaxiaDuskOutline" : "CalamityMod/Items/Weapons/Melee/GalaxiaDawnOutline");
|
||||
|
||||
int currentFrame = ((int)Math.Floor(Main.GlobalTime * 15f)) % 7;
|
||||
Rectangle animFrame = new Rectangle(0, 128 * currentFrame, 126, 126);
|
||||
|
||||
spriteBatch.End();
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, null, null, null, null, Main.UIScaleMatrix);
|
||||
|
||||
spriteBatch.Draw(outlineTexture, position, animFrame, Color.White, 0f, origin, scale, SpriteEffects.None, 0f);
|
||||
|
||||
spriteBatch.End();
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, Main.UIScaleMatrix);
|
||||
|
||||
|
||||
spriteBatch.Draw(itemTexture, position, animFrame, Color.White, 0f, origin, scale, SpriteEffects.None, 0f);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -322,8 +336,22 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
if (mainAttunement == null)
|
||||
mainAttunement = Attunement.attunementArray[(int)AttunementID.Phoenix];
|
||||
|
||||
Texture2D itemTexture = GetTexture((mainAttunement.id == AttunementID.Polaris || mainAttunement.id == AttunementID.Andromeda) ? "CalamityMod/Items/Weapons/Melee/GalaxiaRed" : "CalamityMod/Items/Weapons/Melee/GalaxiaBlue");
|
||||
spriteBatch.Draw(itemTexture, item.Center - Main.screenPosition, null, lightColor, rotation, item.Size * 0.5f, scale, SpriteEffects.None, 0f);
|
||||
Texture2D itemTexture = GetTexture((mainAttunement.id == AttunementID.Polaris || mainAttunement.id == AttunementID.Andromeda) ? "CalamityMod/Items/Weapons/Melee/GalaxiaDusk" : "CalamityMod/Items/Weapons/Melee/GalaxiaDawn");
|
||||
Texture2D outlineTexture = GetTexture((mainAttunement.id == AttunementID.Polaris || mainAttunement.id == AttunementID.Andromeda) ? "CalamityMod/Items/Weapons/Melee/GalaxiaDuskOutline" : "CalamityMod/Items/Weapons/Melee/GalaxiaDawnOutline");
|
||||
|
||||
int currentFrame = ((int)Math.Floor(Main.GlobalTime * 15f)) % 7;
|
||||
Rectangle animFrame = new Rectangle(0, 128 * currentFrame, 126, 126);
|
||||
|
||||
spriteBatch.End();
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, null, null, null, null, Main.UIScaleMatrix);
|
||||
|
||||
spriteBatch.Draw(outlineTexture, item.Center - Main.screenPosition, animFrame, lightColor, rotation, item.Size * 0.5f, scale, SpriteEffects.None, 0f);
|
||||
|
||||
spriteBatch.End();
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, Main.UIScaleMatrix);
|
||||
|
||||
|
||||
spriteBatch.Draw(itemTexture, item.Center - Main.screenPosition, animFrame, lightColor, rotation, item.Size * 0.5f, scale, SpriteEffects.None, 0f);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 3.7 KiB |
@@ -31,6 +31,7 @@ namespace CalamityMod.Items.Weapons.Summon
|
||||
item.shoot = ModContent.ProjectileType<SquirrelSquireMinion>();
|
||||
item.shootSpeed = 10f;
|
||||
item.summon = true;
|
||||
item.sentry = true;
|
||||
}
|
||||
|
||||
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
|
||||
@@ -41,7 +42,8 @@ namespace CalamityMod.Items.Weapons.Summon
|
||||
speedX = 0;
|
||||
speedY = 0;
|
||||
Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 30f);
|
||||
//projectile.ai[1] is attack cooldown. Setting it here prevents immediate attacks
|
||||
player.UpdateMaxTurrets();
|
||||
//projectile.ai[1] is attack cooldown. Setting it here prevents immediate attacks
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -874,7 +874,6 @@ namespace CalamityMod
|
||||
{
|
||||
sAssociation.Call("AddMinionInfo", summonItem, summonBuff, summonProjectile);
|
||||
}
|
||||
RegisterSummon(ItemType<SquirrelSquireStaff>(), BuffType<SquirrelSquireBuff>(), ProjectileType<SquirrelSquireMinion>());
|
||||
RegisterSummon(ItemType<WulfrumController>(), BuffType<WulfrumDroidBuff>(), ProjectileType<WulfrumDroid>());
|
||||
RegisterSummon(ItemType<SunSpiritStaff>(), BuffType<SolarSpirit>(), ProjectileType<SolarPixie>());
|
||||
RegisterSummon(ItemType<FrostBlossomStaff>(), BuffType<FrostBlossomBuff>(), ProjectileType<FrostBlossom>());
|
||||
|
||||
@@ -49,6 +49,9 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm
|
||||
// Base distance from target location in order to continue turning
|
||||
private const float baseTurnDistance = 160f;
|
||||
|
||||
// The distance from target location in order to initiate an attack
|
||||
private const float baseAttackTriggerDistance = 80f;
|
||||
|
||||
// Max distance from the target before they are unable to hear sound telegraphs
|
||||
private const float soundDistance = 2800f;
|
||||
|
||||
@@ -331,7 +334,7 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm
|
||||
Vector2 chargeVector = Vector2.Zero;
|
||||
float chargeDistance = baseDistance;
|
||||
float turnDistance = baseTurnDistance;
|
||||
float chargeLocationDistance = turnDistance * 0.2f;
|
||||
float chargeLocationDistance = baseAttackTriggerDistance;
|
||||
switch ((int)calamityGlobalNPC.newAI[1])
|
||||
{
|
||||
case 0:
|
||||
@@ -369,26 +372,26 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm
|
||||
|
||||
// Lightning Rain variables
|
||||
Vector2 lightningRainLocation = new Vector2(0f, -baseDistance);
|
||||
float lightningRainLocationDistance = turnDistance * 0.2f;
|
||||
float lightningRainLocationDistance = baseAttackTriggerDistance;
|
||||
|
||||
// Wyrm and Eidolist variables
|
||||
Vector2 eidolonWyrmPhaseLocation = new Vector2(0f, baseDistance);
|
||||
float eidolonWyrmPhaseLocationDistance = turnDistance * 0.5f;
|
||||
float eidolonWyrmPhaseLocationDistance = baseAttackTriggerDistance;
|
||||
int eidolistScale = malice ? 4 : death ? 3 : revenge ? 2 : expertMode ? 1 : 0;
|
||||
int maxEidolists = (targetDownDeep ? 3 : 6) + eidolistScale;
|
||||
|
||||
// Ice Mist variables
|
||||
Vector2 iceMistLocation = new Vector2(0f, baseDistance);
|
||||
float iceMistLocationDistance = turnDistance * 0.2f;
|
||||
float iceMistLocationDistance = baseAttackTriggerDistance;
|
||||
|
||||
// Spin variables
|
||||
float spinRadius = baseDistance;
|
||||
Vector2 spinLocation = new Vector2(0f, -spinRadius);
|
||||
float spinLocationDistance = turnDistance * 0.1f;
|
||||
float spinLocationDistance = baseAttackTriggerDistance;
|
||||
|
||||
// Ancient Doom variables
|
||||
Vector2 ancientDoomLocation = new Vector2(0f, -baseDistance);
|
||||
float ancientDoomLocationDistance = turnDistance * 0.2f;
|
||||
float ancientDoomLocationDistance = baseAttackTriggerDistance;
|
||||
int ancientDoomScale = malice ? 4 : death ? 3 : revenge ? 2 : expertMode ? 1 : 0;
|
||||
int ancientDoomLimit = (targetDownDeep ? 4 : 8) + ancientDoomScale;
|
||||
int ancientDoomDistance = malice ? 480 : death ? 520 : revenge ? 535 : expertMode ? 550 : 600;
|
||||
@@ -396,7 +399,7 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm
|
||||
|
||||
// Lightning charge variables
|
||||
Vector2 lightningChargeVector = npc.localAI[2] == 0f ? new Vector2(baseDistance, 0f) : new Vector2(-baseDistance, 0f);
|
||||
float lightningChargeLocationDistance = turnDistance * 0.2f;
|
||||
float lightningChargeLocationDistance = baseAttackTriggerDistance;
|
||||
Vector2 lightningChargeLocation = destination + lightningChargeVector;
|
||||
Vector2 lightningChargeVectorFlipped = lightningChargeVector * -1f;
|
||||
float lightningSpawnY = 540f;
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace CalamityMod.NPCs.Providence
|
||||
npc.noGravity = true;
|
||||
npc.noTileCollide = true;
|
||||
npc.netAlways = true;
|
||||
music = CalamityMod.Instance.GetMusicFromMusicMod("ProvidenceTheme") ?? MusicID.LunarBoss;
|
||||
music = CalamityMod.Instance.GetMusicFromMusicMod("Providence") ?? MusicID.LunarBoss;
|
||||
npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/ProvidenceDeath");
|
||||
bossBag = ModContent.ItemType<ProvidenceBag>();
|
||||
npc.Calamity().VulnerableToHeat = false;
|
||||
@@ -1422,7 +1422,7 @@ namespace CalamityMod.NPCs.Providence
|
||||
return Utils.InverseLerp(drawFireDistanceStart, maxDistance, distanceToTarget, true);
|
||||
}
|
||||
|
||||
private void DespawnSpecificProjectiles()
|
||||
private void DespawnSpecificProjectiles(bool dying = false)
|
||||
{
|
||||
for (int x = 0; x < Main.maxProjectiles; x++)
|
||||
{
|
||||
@@ -1433,6 +1433,17 @@ namespace CalamityMod.NPCs.Providence
|
||||
projectile.Kill();
|
||||
else if (projectile.type == ModContent.ProjectileType<HolyBlast>() || projectile.type == ModContent.ProjectileType<HolyFire>())
|
||||
projectile.active = false;
|
||||
|
||||
if (dying)
|
||||
{
|
||||
if (projectile.type == ModContent.ProjectileType<ProvidenceHolyRay>() || projectile.type == ModContent.ProjectileType<ProvidenceCrystal>() ||
|
||||
projectile.type == ModContent.ProjectileType<ProvidenceCrystalShard>() || projectile.type == ModContent.ProjectileType<HolySpear>() ||
|
||||
projectile.type == ModContent.ProjectileType<HolyBomb>() || projectile.type == ModContent.ProjectileType<MoltenBlob>() ||
|
||||
projectile.type == ModContent.ProjectileType<HolyBurnOrb>() || projectile.type == ModContent.ProjectileType<HolyLight>())
|
||||
projectile.Kill();
|
||||
else if (projectile.type == ModContent.ProjectileType<MoltenBlast>())
|
||||
projectile.active = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1866,6 +1877,7 @@ namespace CalamityMod.NPCs.Providence
|
||||
{
|
||||
if (!Dying)
|
||||
{
|
||||
DespawnSpecificProjectiles(true);
|
||||
Dying = true;
|
||||
npc.life = 1;
|
||||
npc.dontTakeDamage = true;
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
public class DemonicPitchforkProj : ModProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Pitchfork");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 16;
|
||||
projectile.height = 16;
|
||||
projectile.aiStyle = 27;
|
||||
projectile.friendly = true;
|
||||
projectile.magic = true;
|
||||
projectile.penetrate = 2;
|
||||
projectile.timeLeft = 600;
|
||||
aiType = ProjectileID.UnholyTridentFriendly;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.2f / 255f, (255 - projectile.alpha) * 0.01f / 255f, (255 - projectile.alpha) * 0.2f / 255f);
|
||||
if (projectile.localAI[1] > 7f)
|
||||
{
|
||||
int num307 = Main.rand.Next(3);
|
||||
if (num307 == 0)
|
||||
{
|
||||
num307 = 14;
|
||||
}
|
||||
else if (num307 == 1)
|
||||
{
|
||||
num307 = 27;
|
||||
}
|
||||
else
|
||||
{
|
||||
num307 = 173;
|
||||
}
|
||||
int num308 = Dust.NewDust(new Vector2(projectile.position.X - projectile.velocity.X * 4f + 2f, projectile.position.Y + 2f - projectile.velocity.Y * 4f), 8, 8, num307, 0f, 0f, 100, default, 1.25f);
|
||||
Main.dust[num308].velocity *= 0.1f;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
Texture2D tex = Main.projectileTexture[projectile.type];
|
||||
spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void Kill(int timeLeft)
|
||||
{
|
||||
for (int k = 0; k < 2; k++)
|
||||
{
|
||||
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 14, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f);
|
||||
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 27, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f);
|
||||
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 472 B |
@@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Summon
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Acorn");
|
||||
ProjectileID.Sets.MinionShot[projectile.type] = true;
|
||||
ProjectileID.Sets.SentryShot[projectile.type] = true;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
|
||||
@@ -11,28 +11,7 @@ namespace CalamityMod.Projectiles.Summon
|
||||
{
|
||||
public class SquirrelSquireMinion : ModProjectile
|
||||
{
|
||||
public int StuckTimer;
|
||||
public bool TryingToGetCloseToOwner
|
||||
{
|
||||
get => projectile.ai[0] == 1f;
|
||||
set => projectile.ai[0] = value.ToInt();
|
||||
}
|
||||
public ref float AttackTimer => ref projectile.ai[1];
|
||||
public bool OnSolidGround
|
||||
{
|
||||
get
|
||||
{
|
||||
bool groundSolid = false;
|
||||
for (int i = (int)projectile.Left.X / 16 - 1; i < (int)projectile.Right.X / 16 + 1; i++)
|
||||
{
|
||||
bool bottomTileSolid = CalamityUtils.ParanoidTileRetrieval(i, (int)projectile.Bottom.Y / 16).IsTileSolidGround();
|
||||
bool firstTileDownSolid = CalamityUtils.ParanoidTileRetrieval(i, (int)projectile.Bottom.Y / 16 + 1).IsTileSolidGround();
|
||||
bool secondTileDownSolid = CalamityUtils.ParanoidTileRetrieval(i, (int)projectile.Bottom.Y / 16 + 2).IsTileSolidGround();
|
||||
groundSolid |= bottomTileSolid || firstTileDownSolid || secondTileDownSolid;
|
||||
}
|
||||
return projectile.velocity.Y == 0f && groundSolid;
|
||||
}
|
||||
}
|
||||
public bool Attacking
|
||||
{
|
||||
get => projectile.localAI[1] == 1f;
|
||||
@@ -45,7 +24,7 @@ namespace CalamityMod.Projectiles.Summon
|
||||
DisplayName.SetDefault("Squirrel Squire");
|
||||
ProjectileID.Sets.MinionSacrificable[projectile.type] = true;
|
||||
ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true;
|
||||
Main.projFrames[projectile.type] = 17;
|
||||
Main.projFrames[projectile.type] = 17; //About half of these frames are now unused, but I'll still keep them here incase
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
@@ -55,18 +34,13 @@ namespace CalamityMod.Projectiles.Summon
|
||||
projectile.netImportant = true;
|
||||
projectile.friendly = true;
|
||||
projectile.ignoreWater = true;
|
||||
projectile.minionSlots = 1f;
|
||||
projectile.timeLeft = 18000;
|
||||
projectile.timeLeft = Projectile.SentryLifeTime;
|
||||
projectile.penetrate = -1;
|
||||
projectile.tileCollide = false;
|
||||
projectile.timeLeft *= 5;
|
||||
projectile.tileCollide = true;
|
||||
projectile.minion = true;
|
||||
projectile.sentry = true;
|
||||
}
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer) => writer.Write(StuckTimer);
|
||||
|
||||
public override void ReceiveExtraAI(BinaryReader reader) => StuckTimer = reader.ReadInt32();
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (projectile.localAI[0] == 0f)
|
||||
@@ -82,28 +56,23 @@ namespace CalamityMod.Projectiles.Summon
|
||||
projectile.damage = trueDamage;
|
||||
}
|
||||
|
||||
projectile.velocity.Y = MathHelper.Clamp(projectile.velocity.Y + 0.4f, -12f, 12f);
|
||||
projectile.frameCounter++;
|
||||
|
||||
VerifyIdentity();
|
||||
if (!projectile.WithinRange(Owner.Center, 1000f) || TryingToGetCloseToOwner || Collision.SolidCollision(projectile.position + Vector2.One * 4f, projectile.width - 8, projectile.height - 8))
|
||||
{
|
||||
// Once far off, don't go back to normal until 350 pixels away from the owner or less.
|
||||
TryingToGetCloseToOwner = !projectile.WithinRange(Owner.Center, 350f) && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height);
|
||||
|
||||
ReturnToOwner();
|
||||
if (!projectile.WithinRange(Owner.Center, 2000f))
|
||||
{
|
||||
projectile.Center = Owner.Center;
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
projectile.tileCollide = false;
|
||||
return;
|
||||
}
|
||||
|
||||
Attacking = false;
|
||||
NPC potentialTarget = projectile.Center.MinionHoming(800f, Owner, false);
|
||||
if (potentialTarget is null)
|
||||
FollowOwner();
|
||||
{
|
||||
if (projectile.frameCounter > 3)
|
||||
{
|
||||
projectile.frame++;
|
||||
projectile.frameCounter = 0;
|
||||
}
|
||||
if (projectile.frame > 3)
|
||||
{
|
||||
projectile.frame = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Attacking = true;
|
||||
@@ -112,6 +81,7 @@ namespace CalamityMod.Projectiles.Summon
|
||||
|
||||
projectile.rotation = 0f;
|
||||
projectile.tileCollide = true;
|
||||
projectile.StickToTiles(false, false);
|
||||
}
|
||||
|
||||
public void DoInitializationEffects()
|
||||
@@ -130,144 +100,30 @@ namespace CalamityMod.Projectiles.Summon
|
||||
}
|
||||
}
|
||||
|
||||
public void VerifyIdentity()
|
||||
{
|
||||
Owner.AddBuff(ModContent.BuffType<SquirrelSquireBuff>(), 3600);
|
||||
if (projectile.type == ModContent.ProjectileType<SquirrelSquireMinion>())
|
||||
{
|
||||
if (Owner.dead)
|
||||
Owner.Calamity().squirrel = false;
|
||||
if (Owner.Calamity().squirrel)
|
||||
projectile.timeLeft = 2;
|
||||
}
|
||||
}
|
||||
|
||||
public void ReturnToOwner()
|
||||
{
|
||||
projectile.frame = 12 + projectile.frameCounter / 8 % 4;
|
||||
projectile.velocity = projectile.velocity.MoveTowards(projectile.SafeDirectionTo(Owner.Top) * 8f, 0.8f);
|
||||
projectile.spriteDirection = (projectile.velocity.X > 0f).ToDirectionInt();
|
||||
projectile.rotation = projectile.velocity.X * 0.025f;
|
||||
}
|
||||
|
||||
public void AttemptToJumpToDestination(Vector2 destination)
|
||||
{
|
||||
if (OnSolidGround)
|
||||
{
|
||||
float jumpSpeed = MathHelper.Lerp(8f, 13f, Utils.InverseLerp(100f, 250f, MathHelper.Distance(projectile.Center.X, destination.X), true));
|
||||
projectile.velocity = CalamityUtils.GetProjectilePhysicsFiringVelocity(projectile.Center, Owner.Center, 0.4f, jumpSpeed);
|
||||
projectile.spriteDirection = (projectile.velocity.X > 0f).ToDirectionInt();
|
||||
projectile.netUpdate = true;
|
||||
projectile.frame = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (projectile.frameCounter % 5 == 4 && projectile.frame < 7)
|
||||
projectile.frame++;
|
||||
}
|
||||
}
|
||||
|
||||
public void FollowOwner()
|
||||
{
|
||||
projectile.rotation = 0f;
|
||||
|
||||
// Slow down and just idly vibe if close enough to the owner.
|
||||
float horizontalDistanceFromOwner = MathHelper.Distance(projectile.Center.X, Owner.Center.X);
|
||||
float verticalDistanceFromOwner = MathHelper.Distance(projectile.Center.Y, Owner.Center.Y);
|
||||
if (horizontalDistanceFromOwner < 100f && verticalDistanceFromOwner < 450f)
|
||||
{
|
||||
projectile.velocity.X *= 0.94f;
|
||||
if (OnSolidGround)
|
||||
{
|
||||
projectile.frame = projectile.frameCounter / 5 % 4;
|
||||
projectile.velocity *= 0.9f;
|
||||
}
|
||||
StuckTimer = 0;
|
||||
}
|
||||
|
||||
// Otherwise try to catch up with them on foot.
|
||||
else
|
||||
{
|
||||
AttemptToJumpToDestination(Owner.Center);
|
||||
// Determine if there's something in the way of this minion and its owner.
|
||||
if (!Collision.CanHit(projectile.position, projectile.width, projectile.height, Owner.Center, 2, 2) || MathHelper.Distance(projectile.position.X, projectile.oldPosition.X) < 1f)
|
||||
{
|
||||
StuckTimer++;
|
||||
|
||||
// If stuck for a sufficiently long time fly to the owner again.
|
||||
if (StuckTimer > 180)
|
||||
{
|
||||
TryingToGetCloseToOwner = true;
|
||||
StuckTimer = 0;
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
}
|
||||
else if (StuckTimer > 0)
|
||||
StuckTimer--;
|
||||
}
|
||||
|
||||
// Enforce gravity.
|
||||
projectile.velocity.Y = MathHelper.Clamp(projectile.velocity.Y + 0.4f, -12f, 12f);
|
||||
}
|
||||
|
||||
public void AttackTarget(NPC target)
|
||||
{
|
||||
float horizontalDistanceFromTarget = MathHelper.Distance(projectile.Center.X, target.Center.X);
|
||||
AttackTimer++;
|
||||
|
||||
// Determine if the minion is stuck.
|
||||
if (MathHelper.Distance(projectile.position.X, projectile.oldPosition.X) < 1f)
|
||||
// Pelt the target with acorns.
|
||||
projectile.frame = 8 + (int)(AttackTimer / 6.4) % 4;
|
||||
if (Main.myPlayer == projectile.owner && AttackTimer % 30f == 27f)
|
||||
{
|
||||
StuckTimer++;
|
||||
projectile.spriteDirection = (target.Center.X > projectile.Center.X).ToDirectionInt();
|
||||
Vector2 acornSpawnPosition = projectile.Center + new Vector2(projectile.spriteDirection * 6f, 10f);
|
||||
float acornShootSpeed = MathHelper.Lerp(15f, 32f, projectile.Distance(target.Center) / 800f);
|
||||
Vector2 acornShootVelocity = CalamityUtils.GetProjectilePhysicsFiringVelocity(acornSpawnPosition, target.Top + target.velocity * 25f, SquirrelSquireAcorn.Gravity, acornShootSpeed);
|
||||
|
||||
// If stuck for a sufficiently long time fly to the owner again.
|
||||
if (StuckTimer > 180)
|
||||
{
|
||||
TryingToGetCloseToOwner = true;
|
||||
StuckTimer = 0;
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
if (projectile.WithinRange(target.Center, 200f))
|
||||
acornShootVelocity = (target.Center - acornSpawnPosition).SafeNormalize(-Vector2.UnitY) * acornShootSpeed;
|
||||
|
||||
Projectile.NewProjectile(acornSpawnPosition, acornShootVelocity, ModContent.ProjectileType<SquirrelSquireAcorn>(), projectile.damage, projectile.knockBack, projectile.owner);
|
||||
}
|
||||
else if (StuckTimer > 0)
|
||||
StuckTimer--;
|
||||
|
||||
if (horizontalDistanceFromTarget > 350f)
|
||||
AttemptToJumpToDestination(target.Center);
|
||||
else if (OnSolidGround)
|
||||
{
|
||||
projectile.velocity.X *= 0.94f;
|
||||
if (OnSolidGround)
|
||||
{
|
||||
projectile.frame = projectile.frameCounter / 5 % 4;
|
||||
projectile.velocity *= 0.9f;
|
||||
}
|
||||
AttackTimer++;
|
||||
|
||||
// Pelt the target with acorns.
|
||||
projectile.frame = 8 + (int)(AttackTimer / 6.4) % 4;
|
||||
if (Main.myPlayer == projectile.owner && AttackTimer % 30f == 27f)
|
||||
{
|
||||
projectile.spriteDirection = (target.Center.X > projectile.Center.X).ToDirectionInt();
|
||||
Vector2 acornSpawnPosition = projectile.Center + new Vector2(projectile.spriteDirection * 6f, 10f);
|
||||
float acornShootSpeed = MathHelper.Lerp(15f, 32f, projectile.Distance(target.Center) / 800f);
|
||||
Vector2 acornShootVelocity = CalamityUtils.GetProjectilePhysicsFiringVelocity(acornSpawnPosition, target.Top + target.velocity * 25f, SquirrelSquireAcorn.Gravity, acornShootSpeed);
|
||||
|
||||
if (projectile.WithinRange(target.Center, 200f))
|
||||
acornShootVelocity = (target.Center - acornSpawnPosition).SafeNormalize(-Vector2.UnitY) * acornShootSpeed;
|
||||
|
||||
Projectile.NewProjectile(acornSpawnPosition, acornShootVelocity, ModContent.ProjectileType<SquirrelSquireAcorn>(), projectile.damage, projectile.knockBack, projectile.owner);
|
||||
}
|
||||
}
|
||||
projectile.velocity.Y = MathHelper.Clamp(projectile.velocity.Y + 0.4f, -12f, 12f);
|
||||
projectile.velocity.Y = MathHelper.Clamp(projectile.velocity.Y + 0.4f, -12f, 12f);
|
||||
}
|
||||
|
||||
public override bool CanDamage() => false;
|
||||
|
||||
public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough)
|
||||
{
|
||||
fallThrough = !Attacking && projectile.Bottom.Y < Owner.Top.Y;
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool OnTileCollide(Vector2 oldVelocity) => false;
|
||||
|
||||
public override void Kill(int timeLeft)
|
||||
|
||||