Merge branch 'master' into human-scal
No files matched your search
@@ -0,0 +1,27 @@
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Buffs.StatBuffs
|
||||
{
|
||||
class PhantomicArmourBuff : ModBuff
|
||||
{
|
||||
public override void SetDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Phantomic Shield");
|
||||
Description.SetDefault("Defense boosted by 8 and damage reduction boosted by 8%\n" +
|
||||
"An ephemeral bulwark protects you");
|
||||
Main.debuff[Type] = false;
|
||||
Main.pvpBuff[Type] = true;
|
||||
Main.buffNoSave[Type] = true;
|
||||
Main.buffNoTimeDisplay[Type] = true;
|
||||
longerExpertDebuff = false;
|
||||
}
|
||||
|
||||
public override void Update(Player player, ref int buffIndex)
|
||||
{
|
||||
player.endurance += 0.08f;
|
||||
player.statDefense += 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 744 B |
@@ -0,0 +1,25 @@
|
||||
using CalamityMod.CalPlayer;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Buffs.StatBuffs
|
||||
{
|
||||
class PhantomicEmpowermentBuff : ModBuff
|
||||
{
|
||||
public override void SetDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Phantomic Empowerment");
|
||||
Description.SetDefault("Empowering minion damage by 15%");
|
||||
Main.debuff[Type] = false;
|
||||
Main.pvpBuff[Type] = true;
|
||||
Main.buffNoSave[Type] = true;
|
||||
Main.buffNoTimeDisplay[Type] = true;
|
||||
longerExpertDebuff = false;
|
||||
}
|
||||
|
||||
public override void Update(Player player, ref int buffIndex)
|
||||
{
|
||||
player.minionDamage += 0.15f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 638 B |
@@ -0,0 +1,30 @@
|
||||
using CalamityMod.CalPlayer;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Buffs.StatBuffs
|
||||
{
|
||||
class PhantomicRestorationBuff : ModBuff
|
||||
{
|
||||
public override void SetDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Phantomic Regen");
|
||||
Description.SetDefault("Regenerating life");
|
||||
Main.debuff[Type] = false;
|
||||
Main.pvpBuff[Type] = true;
|
||||
Main.buffNoSave[Type] = true;
|
||||
Main.buffNoTimeDisplay[Type] = true;
|
||||
longerExpertDebuff = false;
|
||||
}
|
||||
|
||||
public override void Update(Player player, ref int buffIndex)
|
||||
{
|
||||
CalamityPlayer calPlayer = player.Calamity();
|
||||
if (calPlayer.phantomicHeartRegen <= 0)
|
||||
{
|
||||
calPlayer.phantomicHeartRegen = 1000;
|
||||
}
|
||||
player.lifeRegen += 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 607 B |
@@ -559,6 +559,9 @@ namespace CalamityMod.CalPlayer
|
||||
public bool starTaintedGenerator = false;
|
||||
public bool hallowedRune = false;
|
||||
public int hallowedRuneCooldown = 0;
|
||||
public bool phantomicArtifact = false;
|
||||
public int phantomicBulwarkCooldown = 0;
|
||||
public int phantomicHeartRegen = 0; // 0 = can spawn, 720 = regen applied, 600 = regen stops and 10 sec cd before it can spawn again
|
||||
public bool silvaWings = false;
|
||||
public int icicleCooldown = 0;
|
||||
public bool rustyMedal = false;
|
||||
@@ -1574,6 +1577,7 @@ namespace CalamityMod.CalPlayer
|
||||
sRegen = false;
|
||||
sPower = false;
|
||||
hallowedRune = false;
|
||||
phantomicArtifact = false;
|
||||
hallowedDefense = false;
|
||||
hallowedRegen = false;
|
||||
hallowedPower = false;
|
||||
@@ -2052,6 +2056,8 @@ namespace CalamityMod.CalPlayer
|
||||
icicleCooldown = 0;
|
||||
statisTimer = 0;
|
||||
hallowedRuneCooldown = 0;
|
||||
phantomicBulwarkCooldown = 0;
|
||||
phantomicHeartRegen = 0;
|
||||
sulphurBubbleCooldown = 0;
|
||||
ladHearts = 0;
|
||||
prismaticLasers = 0;
|
||||
@@ -5916,6 +5922,14 @@ namespace CalamityMod.CalPlayer
|
||||
}
|
||||
}
|
||||
|
||||
if (phantomicArtifact && player.ownedProjectileCounts[ModContent.ProjectileType<PhantomicShield>()] != 0)
|
||||
{
|
||||
Projectile pro = Main.projectile.AsEnumerable().Where(projectile => projectile.friendly && projectile.owner == player.whoAmI && projectile.type == ModContent.ProjectileType<PhantomicShield>()).First();
|
||||
phantomicBulwarkCooldown = 1200; // 20 second cooldown
|
||||
pro.Kill();
|
||||
damage = (int)(damage * 0.8f); //20% damage reduction for a projectile.
|
||||
}
|
||||
|
||||
if (auralisAuroraCounter >= 300)
|
||||
{
|
||||
damage -= 100;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using CalamityMod.Buffs.Alcohol;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.Projectiles.Healing;
|
||||
using CalamityMod.Projectiles.Ranged;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
@@ -668,6 +669,22 @@ namespace CalamityMod.CalPlayer
|
||||
player.lifeRegen += 3;
|
||||
}
|
||||
|
||||
if (modPlayer.phantomicHeartRegen <= 720 && modPlayer.phantomicHeartRegen >= 600)
|
||||
{
|
||||
player.lifeRegen += 5; //Boosts the life regen from 3 to 8 for a short time.
|
||||
if (Main.rand.NextBool(2))
|
||||
{
|
||||
int regen = Dust.NewDust(player.position, player.width, player.height, 5, 0f, 0f, 200, new Color(99, 54, 84), 2f);
|
||||
Main.dust[regen].noGravity = true;
|
||||
Main.dust[regen].fadeIn = 1.3f;
|
||||
Vector2 velocity = CalamityUtils.RandomVelocity(100f, 50f, 100f, 0.04f);
|
||||
Main.dust[regen].velocity = velocity;
|
||||
velocity.Normalize();
|
||||
velocity *= 34f;
|
||||
Main.dust[regen].position = player.Center - velocity;
|
||||
}
|
||||
}
|
||||
|
||||
if (modPlayer.community)
|
||||
{
|
||||
float floatTypeBoost = 0.05f +
|
||||
|
||||
@@ -1078,6 +1078,10 @@ namespace CalamityMod.CalPlayer
|
||||
}
|
||||
|
||||
// Cooldowns and timers
|
||||
if (modPlayer.phantomicHeartRegen > 0 && modPlayer.phantomicHeartRegen < 1000)
|
||||
modPlayer.phantomicHeartRegen--;
|
||||
if (modPlayer.phantomicBulwarkCooldown > 0)
|
||||
modPlayer.phantomicBulwarkCooldown--;
|
||||
if (modPlayer.dodgeCooldownTimer > 0)
|
||||
modPlayer.dodgeCooldownTimer--;
|
||||
if (modPlayer.KameiBladeUseDelay > 0)
|
||||
|
||||
@@ -18,6 +18,8 @@ using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using static Terraria.ModLoader.ModContent;
|
||||
using System.Linq;
|
||||
using CalamityMod.Items.Weapons.Summon;
|
||||
|
||||
namespace CalamityMod.CalPlayer
|
||||
{
|
||||
@@ -333,17 +335,45 @@ namespace CalamityMod.CalPlayer
|
||||
{
|
||||
if (npcCheck)
|
||||
{
|
||||
if (modPlayer.sGenerator)
|
||||
if (modPlayer.phantomicArtifact)
|
||||
{
|
||||
int restoreBuff = BuffType<PhantomicRestorationBuff>();
|
||||
int empowerBuff = BuffType<PhantomicEmpowermentBuff>();
|
||||
int shieldBuff = BuffType<PhantomicArmourBuff>();
|
||||
int buffType = Utils.SelectRandom(Main.rand, new int[]
|
||||
{
|
||||
BuffType<SpiritGeneratorAtkBuff>(),
|
||||
BuffType<SpiritGeneratorRegenBuff>(),
|
||||
BuffType<SpiritGeneratorDefBuff>()
|
||||
restoreBuff,
|
||||
empowerBuff,
|
||||
shieldBuff
|
||||
});
|
||||
player.AddBuff(buffType, 120);
|
||||
player.AddBuff(buffType, 420); //7 seconds
|
||||
if (buffType == restoreBuff)
|
||||
{
|
||||
if (modPlayer.phantomicHeartRegen == 1000 && player.ownedProjectileCounts[ModContent.ProjectileType<PhantomicHeart>()] == 0 && Main.rand.NextBool(20))
|
||||
{
|
||||
Vector2 target = proj.Center;
|
||||
target.Y += Main.rand.Next(-50, 50);
|
||||
target.X += Main.rand.Next(-50, 50);
|
||||
Projectile.NewProjectile(target, Vector2.Zero, ModContent.ProjectileType<PhantomicHeart>(), 0, 0f, player.whoAmI, 0f);
|
||||
}
|
||||
}
|
||||
else if (buffType == empowerBuff)
|
||||
{
|
||||
if (player.ownedProjectileCounts[ModContent.ProjectileType<PhantomicDagger>()] < 5 && Main.rand.NextBool(10)) //at most 5
|
||||
{
|
||||
int damage = (int)(100 * player.MinionDamage());
|
||||
Projectile.NewProjectile(proj.position, proj.velocity, ModContent.ProjectileType<PhantomicDagger>(), damage, 1f, player.whoAmI, 0f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (player.ownedProjectileCounts[ModContent.ProjectileType<PhantomicShield>()] == 0 && modPlayer.phantomicBulwarkCooldown == 0)
|
||||
{
|
||||
Projectile.NewProjectile(player.position, Vector2.Zero, ModContent.ProjectileType<PhantomicShield>(), 0, 0f, player.whoAmI, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (modPlayer.hallowedRune)
|
||||
else if (modPlayer.hallowedRune)
|
||||
{
|
||||
int buffType = Utils.SelectRandom(Main.rand, new int[]
|
||||
{
|
||||
@@ -353,6 +383,16 @@ namespace CalamityMod.CalPlayer
|
||||
});
|
||||
player.AddBuff(buffType, 120);
|
||||
}
|
||||
else if (modPlayer.sGenerator)
|
||||
{
|
||||
int buffType = Utils.SelectRandom(Main.rand, new int[]
|
||||
{
|
||||
BuffType<SpiritGeneratorAtkBuff>(),
|
||||
BuffType<SpiritGeneratorRegenBuff>(),
|
||||
BuffType<SpiritGeneratorDefBuff>()
|
||||
});
|
||||
player.AddBuff(buffType, 120);
|
||||
}
|
||||
}
|
||||
|
||||
// Fearmonger set's colossal life regeneration
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace CalamityMod.Items.Accessories
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Hallowed Rune");
|
||||
Tooltip.SetDefault("Whenever your minions hit an enemy you will gain a random buff\n" +
|
||||
Tooltip.SetDefault("Whenever your minions hit an enemy you will gain a random buff, does not stack with downgrades\n" +
|
||||
"These buffs will either boost your defense, summon damage, or life regen for a while\n" +
|
||||
"If you have the offensive boost, enemies hit by minions will sometimes be hit by stars");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
using System.Collections.Generic;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ID;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Items.Placeables.Ores;
|
||||
|
||||
namespace CalamityMod.Items.Accessories
|
||||
{
|
||||
class PhantomicArtifact : ModItem
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Phantomic Artifact");
|
||||
Tooltip.SetDefault("Whenever your minions hit an enemy you will gain a random phantomic buff, does not stack with downgrades\n" +
|
||||
"These buffs will either boost your defense, summon damage, or life regen for a while\n" +
|
||||
"If you have the offensive boost, enemies hit by minions will sometimes be hit by phantomic knives\n" +
|
||||
"If you have the regenerative boost, a phantomic heart will occasionally materialise granting massive health regen\n" +
|
||||
"If you have the defensive boost, a phantomic bulwark will absorb 20% of the next projectile's damage that hits the bulwark, shattering it");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
item.width = 48;
|
||||
item.height = 62;
|
||||
item.value = CalamityGlobalItem.RarityPureGreenBuyPrice;
|
||||
item.rare = ItemRarityID.Red;
|
||||
item.Calamity().customRarity = CalamityRarity.PureGreen;
|
||||
item.accessory = true;
|
||||
}
|
||||
|
||||
public override void UpdateAccessory(Player player, bool hideVisual)
|
||||
{
|
||||
player.Calamity().phantomicArtifact = true;
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
ModRecipe recipe = new ModRecipe(mod);
|
||||
recipe.AddIngredient(ModContent.ItemType<HallowedRune>());
|
||||
recipe.AddIngredient(ModContent.ItemType<Phantoplasm>(), 10);
|
||||
recipe.AddIngredient(ModContent.ItemType<BloodOrb>(), 10);
|
||||
recipe.AddIngredient(ModContent.ItemType<ExodiumClusterOre>(), 20);
|
||||
recipe.AddTile(TileID.LunarCraftingStation);
|
||||
recipe.SetResult(this);
|
||||
recipe.AddRecipe();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,98 @@
|
||||
using CalamityMod.CalPlayer;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System.IO;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Healing
|
||||
{
|
||||
class PhantomicHeart : ModProjectile
|
||||
{
|
||||
private int floatTimer = 0;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Phantomic Heart");
|
||||
Main.projFrames[projectile.type] = 4;
|
||||
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 28;
|
||||
projectile.height = 42;
|
||||
projectile.friendly = true;
|
||||
projectile.alpha = 20;
|
||||
projectile.penetrate = -1;
|
||||
projectile.timeLeft = 600;
|
||||
ProjectileID.Sets.TrailCacheLength[projectile.type] = 4;
|
||||
ProjectileID.Sets.TrailingMode[projectile.type] = 0;
|
||||
}
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(floatTimer);
|
||||
}
|
||||
|
||||
public override void ReceiveExtraAI(BinaryReader reader)
|
||||
{
|
||||
floatTimer = reader.ReadInt32();
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (floatTimer >= 10)
|
||||
{
|
||||
projectile.velocity.Y *= 0.99f;
|
||||
}
|
||||
else
|
||||
{
|
||||
projectile.velocity.Y *= 1.01f;
|
||||
}
|
||||
if (floatTimer >= 20)
|
||||
floatTimer = 0;
|
||||
else
|
||||
floatTimer++;
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
Dust.NewDust(projectile.TopLeft, projectile.width, projectile.height, 5, Main.rand.NextFloat(-3, 3), -5f, 0, new Color(99, 54, 84), Main.rand.NextFloat(0.5f, 1.5f));
|
||||
}
|
||||
|
||||
Player player = Main.player[projectile.owner];
|
||||
Vector2 playerVector = player.Center - projectile.Center;
|
||||
float playerDist = playerVector.Length();
|
||||
if (projectile.timeLeft < 500 && playerDist < 50f && projectile.position.X < player.position.X + player.width && projectile.position.X + projectile.width > player.position.X && projectile.position.Y < player.position.Y + player.height && projectile.position.Y + projectile.height > player.position.Y)
|
||||
{
|
||||
if (player.whoAmI == Main.myPlayer)
|
||||
{
|
||||
CalamityPlayer calPlayer = player.Calamity();
|
||||
calPlayer.phantomicHeartRegen = 720;
|
||||
projectile.Kill();
|
||||
}
|
||||
}
|
||||
if (player.lifeMagnet && projectile.timeLeft < 510)
|
||||
{
|
||||
float N = 18f;
|
||||
playerDist = 15f / playerDist;
|
||||
playerVector.X *= playerDist;
|
||||
playerVector.Y *= playerDist;
|
||||
projectile.velocity.X = (projectile.velocity.X * N + playerVector.X) / (N + 1f);
|
||||
projectile.velocity.Y = (projectile.velocity.Y * N + playerVector.Y) / (N + 1f);
|
||||
}
|
||||
projectile.frameCounter++;
|
||||
if (projectile.frameCounter > 5)
|
||||
{
|
||||
projectile.frame++;
|
||||
projectile.frameCounter = 0;
|
||||
if (projectile.frame % 2 == 0)
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
if (projectile.frame > 3)
|
||||
{
|
||||
projectile.frame = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 906 B |
@@ -0,0 +1,145 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.IO;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Summon
|
||||
{
|
||||
class PhantomicDagger : ModProjectile
|
||||
{
|
||||
private bool homing = false;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Phantom Dagger");
|
||||
ProjectileID.Sets.TrailingMode[projectile.type] = 0;
|
||||
ProjectileID.Sets.TrailCacheLength[projectile.type] = 7;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 12;
|
||||
projectile.height = 38;
|
||||
projectile.netImportant = true;
|
||||
projectile.friendly = true;
|
||||
projectile.ignoreWater = true;
|
||||
projectile.timeLeft = 600;
|
||||
projectile.penetrate = 1;
|
||||
projectile.tileCollide = false;
|
||||
projectile.alpha = 200;
|
||||
projectile.minion = true;
|
||||
}
|
||||
|
||||
public override bool? CanHitNPC(NPC target)
|
||||
{
|
||||
if (homing)
|
||||
return null; //cannot hit until it is beginning to home.
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(homing);
|
||||
}
|
||||
|
||||
public override void ReceiveExtraAI(BinaryReader reader)
|
||||
{
|
||||
homing = reader.ReadBoolean();
|
||||
}
|
||||
|
||||
public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
|
||||
{
|
||||
//Avoid touching things that you probably aren't meant to damage
|
||||
if (target.defense > 999 || target.Calamity().DR >= 0.95f || target.Calamity().unbreakableDR)
|
||||
return;
|
||||
int cap = (int)(damage * 1.05f); //capped at 5% dr ignoring
|
||||
damage = Math.Min((int)(damage * (1 / (1 - target.Calamity().DR))), cap);
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
for (int d = 0; d < 4; d++)
|
||||
{
|
||||
int shadow = Dust.NewDust(projectile.position, projectile.width, projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 2f);
|
||||
Main.dust[shadow].velocity *= 3f;
|
||||
if (Main.rand.NextBool(2))
|
||||
{
|
||||
Main.dust[shadow].scale = 0.5f;
|
||||
Main.dust[shadow].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
|
||||
}
|
||||
}
|
||||
for (int d = 0; d < 12; d++)
|
||||
{
|
||||
int shadow = Dust.NewDust(projectile.position, projectile.width, projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 3f);
|
||||
Main.dust[shadow].noGravity = true;
|
||||
Main.dust[shadow].velocity *= 5f;
|
||||
shadow = Dust.NewDust(projectile.position, projectile.width, projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 2f);
|
||||
Main.dust[shadow].velocity *= 2f;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
if (CalamityConfig.Instance.Afterimages)
|
||||
{
|
||||
CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (Main.dust.Length < Main.maxDust - 3)
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 3f); //new Color(99, 54, 84)
|
||||
Main.dust[dust].noGravity = true;
|
||||
}
|
||||
}
|
||||
if (projectile.alpha != 0)
|
||||
{
|
||||
projectile.rotation -= 0.25f;
|
||||
projectile.velocity.X *= 0.985f;
|
||||
projectile.velocity.Y *= 0.985f;
|
||||
if (projectile.alpha < 3)
|
||||
{
|
||||
projectile.alpha = 0;
|
||||
homing = true;
|
||||
}
|
||||
else
|
||||
projectile.alpha -= 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
NPC target = CalamityUtils.MinionHoming(projectile.Center, 1500f, Main.player[projectile.owner]);
|
||||
if (target != null)
|
||||
{
|
||||
float num550 = 40f;
|
||||
Vector2 vector43 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
|
||||
float num551 = target.Center.X - vector43.X;
|
||||
float num552 = target.Center.Y - vector43.Y;
|
||||
float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552));
|
||||
if (num553 < 100f)
|
||||
{
|
||||
num550 = 28f; //14
|
||||
}
|
||||
num553 = num550 / num553;
|
||||
num551 *= num553;
|
||||
num552 *= num553;
|
||||
projectile.velocity.X = (projectile.velocity.X * 25f + num551) / 26f;
|
||||
projectile.velocity.Y = (projectile.velocity.Y * 25f + num552) / 26f;
|
||||
}
|
||||
else
|
||||
{
|
||||
projectile.velocity *= 0.9f;
|
||||
}
|
||||
projectile.rotation = projectile.velocity.ToRotation() + (float)Math.Atan(90);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 472 B |
@@ -0,0 +1,109 @@
|
||||
using CalamityMod.Buffs.StatBuffs;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System.IO;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Summon
|
||||
{
|
||||
class PhantomicShield : ModProjectile
|
||||
{
|
||||
public const float floatDist = 50f;
|
||||
|
||||
public int deathTimer = 240;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Phantomic Bulwark");
|
||||
Main.projFrames[projectile.type] = 4;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 38;
|
||||
projectile.height = 56;
|
||||
projectile.netImportant = true;
|
||||
projectile.friendly = true;
|
||||
projectile.ignoreWater = true;
|
||||
projectile.minionSlots = 0f;
|
||||
projectile.timeLeft = 18000;
|
||||
projectile.penetrate = 1;
|
||||
projectile.tileCollide = false;
|
||||
projectile.timeLeft *= 5;
|
||||
projectile.minion = true;
|
||||
}
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(deathTimer);
|
||||
}
|
||||
|
||||
public override void ReceiveExtraAI(BinaryReader reader)
|
||||
{
|
||||
deathTimer = reader.ReadInt32();
|
||||
}
|
||||
|
||||
public override void Kill(int timeLeft)
|
||||
{
|
||||
for (int d = 0; d < 6; d++)
|
||||
{
|
||||
int shadow = Dust.NewDust(projectile.position, projectile.width, projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 2f);
|
||||
Main.dust[shadow].velocity *= 3f;
|
||||
if (Main.rand.NextBool(2))
|
||||
{
|
||||
Main.dust[shadow].scale = 0.5f;
|
||||
Main.dust[shadow].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
|
||||
}
|
||||
}
|
||||
for (int d = 0; d < 18; d++)
|
||||
{
|
||||
int shadow = Dust.NewDust(projectile.position, projectile.width, projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 3f);
|
||||
Main.dust[shadow].noGravity = true;
|
||||
Main.dust[shadow].velocity *= 5f;
|
||||
shadow = Dust.NewDust(projectile.position, projectile.width, projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 2f);
|
||||
Main.dust[shadow].velocity *= 2f;
|
||||
}
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Player owner = Main.player[projectile.owner];
|
||||
NPC target = CalamityUtils.MinionHoming(owner.position, 1500f, owner);
|
||||
if (target != null)
|
||||
{
|
||||
Vector2 pos1 = owner.position;
|
||||
Vector2 pos2 = target.position;
|
||||
projectile.ai[0] = (pos2 - pos1).ToRotation();
|
||||
}
|
||||
else
|
||||
{
|
||||
projectile.ai[0] -= MathHelper.ToRadians(2f);
|
||||
}
|
||||
if (target == null)
|
||||
{
|
||||
deathTimer--;
|
||||
}
|
||||
else
|
||||
{
|
||||
deathTimer = 240;
|
||||
}
|
||||
if (owner.dead || deathTimer <= 0)
|
||||
projectile.Kill();
|
||||
projectile.Center = owner.Center + projectile.ai[0].ToRotationVector2() * floatDist;
|
||||
projectile.rotation = (owner.Center - projectile.Center).ToRotation();
|
||||
|
||||
projectile.frameCounter++;
|
||||
if (projectile.frameCounter > 5)
|
||||
{
|
||||
projectile.frame++;
|
||||
projectile.frameCounter = 0;
|
||||
if (projectile.frame % 2 == 0)
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
if (projectile.frame > 3)
|
||||
{
|
||||
projectile.frame = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.2 KiB |