This commit is contained in:
AlterraKira committed 2019-11-27 20:42:51 +00:00
commit 681e0dd784
40 files changed
+438 -66

No files matched your search

+2 -1
View File
@@ -25,7 +25,8 @@ namespace CalamityMod.Buffs.DamageOverTime
public override void Update(NPC npc, ref int buffIndex)
{
npc.Calamity().aFlames = npc.buffTime[buffIndex];
if (npc.Calamity().aFlames < npc.buffTime[buffIndex])
npc.Calamity().aFlames = npc.buffTime[buffIndex];
npc.DelBuff(buffIndex);
buffIndex--;
}
@@ -24,7 +24,8 @@ namespace CalamityMod.Buffs.DamageOverTime
public override void Update(NPC npc, ref int buffIndex)
{
npc.Calamity().astralInfection = npc.buffTime[buffIndex];
if (npc.Calamity().astralInfection < npc.buffTime[buffIndex])
npc.Calamity().astralInfection = npc.buffTime[buffIndex];
npc.DelBuff(buffIndex);
buffIndex--;
}
+2 -1
View File
@@ -22,7 +22,8 @@ namespace CalamityMod.Buffs.DamageOverTime
public override void Update(NPC npc, ref int buffIndex)
{
npc.Calamity().bFlames = npc.buffTime[buffIndex];
if (npc.Calamity().bFlames < npc.buffTime[buffIndex])
npc.Calamity().bFlames = npc.buffTime[buffIndex];
npc.DelBuff(buffIndex);
buffIndex--;
}
+2 -1
View File
@@ -22,7 +22,8 @@ namespace CalamityMod.Buffs.DamageOverTime
public override void Update(NPC npc, ref int buffIndex)
{
npc.Calamity().bBlood = npc.buffTime[buffIndex];
if (npc.Calamity().bBlood < npc.buffTime[buffIndex])
npc.Calamity().bBlood = npc.buffTime[buffIndex];
npc.DelBuff(buffIndex);
buffIndex--;
}
+2 -1
View File
@@ -22,7 +22,8 @@ namespace CalamityMod.Buffs.DamageOverTime
public override void Update(NPC npc, ref int buffIndex)
{
npc.Calamity().cDepth = npc.buffTime[buffIndex];
if (npc.Calamity().cDepth < npc.buffTime[buffIndex])
npc.Calamity().cDepth = npc.buffTime[buffIndex];
npc.DelBuff(buffIndex);
buffIndex--;
}
+2 -1
View File
@@ -17,7 +17,8 @@ namespace CalamityMod.Buffs.DamageOverTime
public override void Update(NPC npc, ref int buffIndex)
{
npc.Calamity().dFlames = npc.buffTime[buffIndex];
if (npc.Calamity().dFlames < npc.buffTime[buffIndex])
npc.Calamity().dFlames = npc.buffTime[buffIndex];
npc.DelBuff(buffIndex);
buffIndex--;
}
+2 -1
View File
@@ -24,7 +24,8 @@ namespace CalamityMod.Buffs.DamageOverTime
public override void Update(NPC npc, ref int buffIndex)
{
npc.Calamity().gsInferno = npc.buffTime[buffIndex];
if (npc.Calamity().gsInferno < npc.buffTime[buffIndex])
npc.Calamity().gsInferno = npc.buffTime[buffIndex];
npc.DelBuff(buffIndex);
buffIndex--;
}
+2 -1
View File
@@ -22,7 +22,8 @@ namespace CalamityMod.Buffs.DamageOverTime
public override void Update(NPC npc, ref int buffIndex)
{
npc.Calamity().hFlames = npc.buffTime[buffIndex];
if (npc.Calamity().hFlames < npc.buffTime[buffIndex])
npc.Calamity().hFlames = npc.buffTime[buffIndex];
npc.DelBuff(buffIndex);
buffIndex--;
}
+2 -1
View File
@@ -17,7 +17,8 @@ namespace CalamityMod.Buffs.DamageOverTime
public override void Update(NPC npc, ref int buffIndex)
{
npc.Calamity().nightwither = npc.buffTime[buffIndex];
if (npc.Calamity().nightwither < npc.buffTime[buffIndex])
npc.Calamity().nightwither = npc.buffTime[buffIndex];
npc.DelBuff(buffIndex);
buffIndex--;
}
+2 -1
View File
@@ -24,7 +24,8 @@ namespace CalamityMod.Buffs.DamageOverTime
public override void Update(NPC npc, ref int buffIndex)
{
npc.Calamity().pFlames = npc.buffTime[buffIndex];
if (npc.Calamity().pFlames < npc.buffTime[buffIndex])
npc.Calamity().pFlames = npc.buffTime[buffIndex];
npc.DelBuff(buffIndex);
buffIndex--;
}
+2 -1
View File
@@ -16,7 +16,8 @@ namespace CalamityMod.Buffs.DamageOverTime
public override void Update(NPC npc, ref int buffIndex)
{
npc.Calamity().shellfishVore = npc.buffTime[buffIndex];
if (npc.Calamity().shellfishVore < npc.buffTime[buffIndex])
npc.Calamity().shellfishVore = npc.buffTime[buffIndex];
npc.DelBuff(buffIndex);
buffIndex--;
}
+2 -1
View File
@@ -17,7 +17,8 @@ namespace CalamityMod.Buffs.DamageOverTime
public override void Update(NPC npc, ref int buffIndex)
{
npc.Calamity().pShred = npc.buffTime[buffIndex];
if (npc.Calamity().pShred < npc.buffTime[buffIndex])
npc.Calamity().pShred = npc.buffTime[buffIndex];
npc.DelBuff(buffIndex);
buffIndex--;
}
+2 -1
View File
@@ -16,7 +16,8 @@ namespace CalamityMod.Buffs.DamageOverTime
public override void Update(NPC npc, ref int buffIndex)
{
npc.Calamity().clamDebuff = npc.buffTime[buffIndex];
if (npc.Calamity().clamDebuff < npc.buffTime[buffIndex])
npc.Calamity().clamDebuff = npc.buffTime[buffIndex];
npc.DelBuff(buffIndex);
buffIndex--;
}
+2 -1
View File
@@ -22,7 +22,8 @@ namespace CalamityMod.Buffs.DamageOverTime
public override void Update(NPC npc, ref int buffIndex)
{
npc.Calamity().sulphurPoison = npc.buffTime[buffIndex];
if (npc.Calamity().sulphurPoison < npc.buffTime[buffIndex])
npc.Calamity().sulphurPoison = npc.buffTime[buffIndex];
npc.DelBuff(buffIndex);
buffIndex--;
}
+4 -1
View File
@@ -24,7 +24,10 @@ namespace CalamityMod.Buffs.Placeables
public override void Update(NPC npc, ref int buffIndex)
{
npc.Calamity().yellowCandle = true;
if (npc.Calamity().yellowCandle < npc.buffTime[buffIndex])
npc.Calamity().yellowCandle = npc.buffTime[buffIndex];
npc.DelBuff(buffIndex);
buffIndex--;
}
}
}
+2 -1
View File
@@ -20,7 +20,8 @@ namespace CalamityMod.Buffs.StatDebuffs
public override void Update(NPC npc, ref int buffIndex)
{
npc.Calamity().aCrunch = npc.buffTime[buffIndex];
if (npc.Calamity().aCrunch < npc.buffTime[buffIndex])
npc.Calamity().aCrunch = npc.buffTime[buffIndex];
npc.DelBuff(buffIndex);
buffIndex--;
}
+2 -1
View File
@@ -23,7 +23,8 @@ namespace CalamityMod.Buffs.StatDebuffs
public override void Update(NPC npc, ref int buffIndex)
{
npc.Calamity().enraged = npc.buffTime[buffIndex];
if (npc.Calamity().enraged < npc.buffTime[buffIndex])
npc.Calamity().enraged = npc.buffTime[buffIndex];
npc.DelBuff(buffIndex);
buffIndex--;
}
+4 -1
View File
@@ -17,7 +17,10 @@ namespace CalamityMod.Buffs.StatDebuffs
public override void Update(NPC npc, ref int buffIndex)
{
npc.Calamity().eFreeze = true;
if (npc.Calamity().eFreeze < npc.buffTime[buffIndex])
npc.Calamity().eFreeze = npc.buffTime[buffIndex];
npc.DelBuff(buffIndex);
buffIndex--;
}
}
}
+4 -1
View File
@@ -24,7 +24,10 @@ namespace CalamityMod.Buffs.StatDebuffs
public override void Update(NPC npc, ref int buffIndex)
{
npc.Calamity().gState = true;
if (npc.Calamity().gState < npc.buffTime[buffIndex])
npc.Calamity().gState = npc.buffTime[buffIndex];
npc.DelBuff(buffIndex);
buffIndex--;
}
}
}
+2 -1
View File
@@ -24,7 +24,8 @@ namespace CalamityMod.Buffs.StatDebuffs
public override void Update(NPC npc, ref int buffIndex)
{
npc.Calamity().irradiated = npc.buffTime[buffIndex];
if (npc.Calamity().irradiated < npc.buffTime[buffIndex])
npc.Calamity().irradiated = npc.buffTime[buffIndex];
npc.DelBuff(buffIndex);
buffIndex--;
}
+2 -1
View File
@@ -17,7 +17,8 @@ namespace CalamityMod.Buffs.StatDebuffs
public override void Update(NPC npc, ref int buffIndex)
{
npc.Calamity().marked = npc.buffTime[buffIndex];
if (npc.Calamity().marked < npc.buffTime[buffIndex])
npc.Calamity().marked = npc.buffTime[buffIndex];
npc.DelBuff(buffIndex);
buffIndex--;
}
+4 -1
View File
@@ -16,7 +16,10 @@ namespace CalamityMod.Buffs.StatDebuffs
public override void Update(NPC npc, ref int buffIndex)
{
npc.Calamity().pearlAura = true;
if (npc.Calamity().pearlAura < npc.buffTime[buffIndex])
npc.Calamity().pearlAura = npc.buffTime[buffIndex];
npc.DelBuff(buffIndex);
buffIndex--;
}
}
}
+4 -1
View File
@@ -17,7 +17,10 @@ namespace CalamityMod.Buffs.StatDebuffs
public override void Update(NPC npc, ref int buffIndex)
{
npc.Calamity().silvaStun = true;
if (npc.Calamity().silvaStun < npc.buffTime[buffIndex])
npc.Calamity().silvaStun = npc.buffTime[buffIndex];
npc.DelBuff(buffIndex);
buffIndex--;
}
}
}
+4 -1
View File
@@ -17,7 +17,10 @@ namespace CalamityMod.Buffs.StatDebuffs
public override void Update(NPC npc, ref int buffIndex)
{
npc.Calamity().tSad = true;
if (npc.Calamity().tSad < npc.buffTime[buffIndex])
npc.Calamity().tSad = npc.buffTime[buffIndex];
npc.DelBuff(buffIndex);
buffIndex--;
}
}
}
+4 -1
View File
@@ -18,7 +18,10 @@ namespace CalamityMod.Buffs.StatDebuffs
public override void Update(NPC npc, ref int buffIndex)
{
npc.Calamity().timeSlow = true;
if (npc.Calamity().timeSlow < npc.buffTime[buffIndex])
npc.Calamity().timeSlow = npc.buffTime[buffIndex];
npc.DelBuff(buffIndex);
buffIndex--;
}
/*public override void Update(Player player, ref int buffIndex)
+2 -1
View File
@@ -19,7 +19,8 @@ namespace CalamityMod.Buffs.StatDebuffs
public override void Update(NPC npc, ref int buffIndex)
{
npc.Calamity().wCleave = npc.buffTime[buffIndex];
if (npc.Calamity().wCleave < npc.buffTime[buffIndex])
npc.Calamity().wCleave = npc.buffTime[buffIndex];
npc.DelBuff(buffIndex);
buffIndex--;
}
+2 -1
View File
@@ -24,7 +24,8 @@ namespace CalamityMod.Buffs.StatDebuffs
public override void Update(NPC npc, ref int buffIndex)
{
npc.Calamity().wDeath = npc.buffTime[buffIndex];
if (npc.Calamity().wDeath < npc.buffTime[buffIndex])
npc.Calamity().wDeath = npc.buffTime[buffIndex];
npc.DelBuff(buffIndex);
buffIndex--;
}
+1 -1
View File
@@ -4325,7 +4325,7 @@ namespace CalamityMod.CalPlayer
{
float distance = (Main.npc[m].Center - player.Center).Length();
if (distance < 120f)
Main.npc[m].AddBuff(ModContent.BuffType<PearlAura>(), 2, false);
Main.npc[m].AddBuff(ModContent.BuffType<PearlAura>(), 20, false);
}
}
}
+3 -2
View File
@@ -1,4 +1,5 @@
using CalamityMod.Items.Placeables.Walls;
using CalamityMod.Items.Materials;
using Terraria.ID;
using Terraria;
using Terraria.ModLoader;
@@ -68,7 +69,7 @@ namespace CalamityMod.Items.Placeables
}
else if (val < 48.03f)
{
resultType = ModContent.ItemType<Items.Materials.AncientBoneDust>();
resultType = ModContent.ItemType<AncientBoneDust>();
resultStack = Main.rand.Next(1, 11);
}
else if (val < 58.03f && !Main.dayTime)
@@ -83,7 +84,7 @@ namespace CalamityMod.Items.Placeables
}
else if (val < 68.03f)
{
resultType = ModContent.ItemType<Items.Materials.Stardust>();
resultType = ModContent.ItemType<Stardust>();
resultStack = Main.rand.Next(1, 11);
}
else if (val < 69.03f)
+4 -4
View File
@@ -1,4 +1,4 @@
using CalamityMod.Items.Materials;
using Terraria.ID;
using Terraria;
using Terraria.ModLoader;
@@ -62,7 +62,7 @@ namespace CalamityMod.Items.Placeables
}
else if (val < 58.03f)
{
resultType = ModContent.ItemType<Items.Materials.Stardust>();
resultType = ModContent.ItemType<Stardust>();
resultStack = Main.rand.Next(1, 21);
}
else if (val < 61.03f)
@@ -120,12 +120,12 @@ namespace CalamityMod.Items.Placeables
resultType = ItemID.OrichalcumOre;
resultStack = Main.rand.Next(1, 17);
}
else if (val < 87.78f)
else if (val < 86.78f)
{
resultType = ItemID.AdamantiteOre;
resultStack = Main.rand.Next(1, 17);
}
else if (val < 89.53f)
else if (val < 88.53f)
{
resultType = ItemID.TitaniumOre;
resultStack = Main.rand.Next(1, 17);
+1 -1
View File
@@ -62,7 +62,7 @@ namespace CalamityMod.Items.Weapons.Melee
damage *= 2;
knockBack *= 2f;
}
else if (target.Calamity().gState)
else if (target.Calamity().gState > 0)
{
damage *= 3;
knockBack *= 3f;
+1 -1
View File
@@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Rogue
{
if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike
{
int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType<BloodsoakedCrashax>(), damage, knockBack, player.whoAmI, 0f, 1f);
int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 1f);
Main.projectile[stealth].Calamity().stealthStrike = true;
return false;
}
+48
View File
@@ -0,0 +1,48 @@
using CalamityMod.Projectiles.Rogue;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Microsoft.Xna.Framework;
namespace CalamityMod.Items.Weapons.Rogue
{
public class Shroomerang : RogueWeapon
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Shroomerang");
Tooltip.SetDefault(@"Fires a slow, long-ranged boomerang
Stealth strikes grant the Mushy buff to the user on enemy hits and summon homing spores");
}
public override void SafeSetDefaults()
{
item.width = 26;
item.damage = 18;
item.noMelee = true;
item.noUseGraphic = true;
item.useTime = 20;
item.useAnimation = 20;
item.useStyle = 1;
item.knockBack = 1.5f;
item.UseSound = SoundID.Item1;
item.height = 50;
item.rare = 2;
item.value = Item.buyPrice(0, 2, 0, 0);
item.shoot = ModContent.ProjectileType<ShroomerangProj>();
item.shootSpeed = 15f;
item.Calamity().rogue = 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)
{
if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike
{
int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f);
Main.projectile[stealth].Calamity().stealthStrike = true;
return false;
}
return true;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 623 B

+49 -29
View File
@@ -90,13 +90,13 @@ namespace CalamityMod.NPCs
public static bool DraedonMayhem = false;
// Debuffs
public bool timeSlow = false;
public bool gState = false;
public bool tSad = false;
public bool eFreeze = false;
public bool silvaStun = false;
public bool yellowCandle = false;
public bool pearlAura = false;
public int timeSlow = 0;
public int gState = 0;
public int tSad = 0;
public int eFreeze = 0;
public int silvaStun = 0;
public int yellowCandle = 0;
public int pearlAura = 0;
public int wCleave = 0;
public int bBlood = 0;
public int dFlames = 0;
@@ -328,14 +328,6 @@ namespace CalamityMod.NPCs
ResetSavedIndex(ref SCalCatastrophe);
ResetSavedIndex(ref SCal);
ResetSavedIndex(ref SCalWorm);
timeSlow = false;
gState = false;
tSad = false;
eFreeze = false;
silvaStun = false;
yellowCandle = false;
pearlAura = false;
}
#endregion
@@ -502,26 +494,40 @@ namespace CalamityMod.NPCs
// Exo Freeze, Glacial State and Temporal Sadness don't work on bosses or other specific enemies.
if (!npc.boss && !CalamityMod.movementImpairImmuneList.Contains(npc.type))
{
if (eFreeze && !CalamityWorld.bossRushActive)
if (eFreeze > 0 && !CalamityWorld.bossRushActive)
{
npc.velocity.X = 0f;
npc.velocity.Y += 0.1f;
if (npc.velocity.Y > 15f)
npc.velocity.Y = 15f;
}
else if (gState)
else if (gState > 0)
{
npc.velocity.X = 0f;
npc.velocity.Y += 0.05f;
if (npc.velocity.Y > 15f)
npc.velocity.Y = 15f;
}
if (tSad)
if (tSad > 0)
{
npc.velocity /= 2f;
}
}
//Oiled debuff makes flame debuffs 50% more effective (instead of vanilla 25%)
/*if (npc.oiled)
{
int num1 = (npc.onFire ? 2 : 0) + (npc.onFrostBurn ? 4 : 0) + (npc.onFire2 ? 3 : 0) + (npc.shadowFlame ? 7 : 0) + (bFlames ? 20 : 0) + (hFlames ? 25 : 0) + (gsInferno ? 125 : 0) + (aFlames ? 63 : 0) + (dFlames ? 1250 : 0);
if (num1 > 0)
{
int num2 = num1 * 4 + 12;
npc.lifeRegen = npc.lifeRegen - num2;
int num3 = num2 / 6;
if (amount < num3)
amount = num3;
}
}*/
ApplyDPSDebuff(irradiated, 20, 4, ref npc.lifeRegen, ref damage);
ApplyDPSDebuff(bFlames, 40, 8, ref npc.lifeRegen, ref damage);
ApplyDPSDebuff(hFlames, 50, 10, ref npc.lifeRegen, ref damage);
@@ -1162,7 +1168,7 @@ namespace CalamityMod.NPCs
#region Modify Hit Player
public override void ModifyHitPlayer(NPC npc, Player target, ref int damage, ref bool crit)
{
if (tSad)
if (tSad > 0)
{
damage /= 2;
}
@@ -1219,7 +1225,7 @@ namespace CalamityMod.NPCs
(astralInfection > 0 ? AstralInfectionDebuff.DefenseReduction : 0) -
(aFlames > 0 ? AbyssalFlames.DefenseReduction : 0) -
(wCleave > 0 ? WarCleave.DefenseReduction : 0) -
(gState ? GlacialState.DefenseReduction : 0) -
(gState > 0 ? GlacialState.DefenseReduction : 0) -
(aCrunch > 0 ? ArmorCrunch.DefenseReduction : 0);
// Defense can never be negative and has a minimum value of zero.
@@ -1233,7 +1239,7 @@ namespace CalamityMod.NPCs
damage = ApplyDR(npc, damage);
// Add Yellow Candle damage if the NPC isn't supposed to be "near invincible"
if (yellowCandle && DR < 0.99f && npc.takenDamageMultiplier > 0.05f)
if (yellowCandle > 0 && DR < 0.99f && npc.takenDamageMultiplier > 0.05f)
damage += yellowCandleDamage;
// Cancel out vanilla defense math by reversing the calculation vanilla is about to perform.
@@ -2095,6 +2101,20 @@ namespace CalamityMod.NPCs
public override void PostAI(NPC npc)
{
//Debuff decrements
if (timeSlow > 0)
timeSlow--;
if (gState > 0)
gState--;
if (tSad > 0)
tSad--;
if (eFreeze > 0)
eFreeze--;
if (silvaStun > 0)
silvaStun--;
if (yellowCandle > 0)
yellowCandle--;
if (pearlAura > 0)
pearlAura--;
if (wCleave > 0)
wCleave--;
if (bBlood > 0)
@@ -2140,14 +2160,14 @@ namespace CalamityMod.NPCs
if (npc.boss || CalamityMod.movementImpairImmuneList.Contains(npc.type))
return;
if (pearlAura && !CalamityPlayer.areThereAnyDamnBosses)
npc.velocity *= 0.95f;
if (pearlAura > 0 && !CalamityPlayer.areThereAnyDamnBosses)
npc.velocity *= 0.9f;
if (!CalamityWorld.bossRushActive)
{
if (silvaStun)
if (silvaStun > 0)
npc.velocity = Vector2.Zero;
else if (timeSlow)
else if (timeSlow > 0)
npc.velocity *= 0.85f;
}
}
@@ -3023,7 +3043,7 @@ namespace CalamityMod.NPCs
dust.scale += Main.rand.NextFloat();
}
}
if (tSad || cDepth > 0)
if (tSad > 0 || cDepth > 0)
{
if (Main.rand.Next(6) < 3)
{
@@ -3070,7 +3090,7 @@ namespace CalamityMod.NPCs
}
}
if (gState || eFreeze)
if (gState > 0 || eFreeze > 0)
{
drawColor = Color.Cyan;
}
@@ -3080,12 +3100,12 @@ namespace CalamityMod.NPCs
drawColor = Color.Fuchsia;
}
if (pearlAura)
if (pearlAura > 0)
{
drawColor = Color.White;
}
if (timeSlow)
if (timeSlow > 0)
{
drawColor = Color.Aquamarine;
}
+1 -1
View File
@@ -582,7 +582,7 @@ namespace CalamityMod.Projectiles
else if (projectile.type == ProjectileID.SoulDrain)
projectile.magic = true;
if (!projectile.npcProj && projectile.friendly)
if (!projectile.npcProj && projectile.friendly && projectile.damage > 0)
{
if (Main.player[projectile.owner].Calamity().eQuiver && projectile.ranged && CalamityMod.rangedProjectileExceptionList.TrueForAll(x => projectile.type != x))
{
+68
View File
@@ -0,0 +1,68 @@
using CalamityMod.Buffs.StatBuffs;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Rogue
{
public class ShroomerangProj : ModProjectile
{
public int stealthCounter = 0;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Shroomerang");
}
public override void SetDefaults()
{
projectile.width = 30;
projectile.height = 30;
projectile.friendly = true;
projectile.penetrate = -1;
projectile.aiStyle = 3;
projectile.timeLeft = 300;
aiType = 52;
projectile.Calamity().rogue = true;
}
public override void AI()
{
Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.35f / 255f, (255 - projectile.alpha) * 0.5f / 255f);
if (Main.rand.NextBool(5))
{
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 56, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f);
}
if (projectile.Calamity().stealthStrike == true)
{
stealthCounter++;
if (stealthCounter == 8 && projectile.owner == Main.myPlayer)
{
Vector2 vector62 = Main.player[projectile.owner].Center - projectile.Center;
stealthCounter = 0;
Vector2 vector63 = vector62 * -1f;
vector63.Normalize();
vector63 *= (float)Main.rand.Next(45, 65) * 0.1f;
vector63 = vector63.RotatedBy((Main.rand.NextDouble() - 0.5) * 1.5707963705062866, default);
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector63.X, vector63.Y, ModContent.ProjectileType<ShroomerangSpore>(), (int)((double)projectile.damage * 0.6), projectile.knockBack * 0.2f, projectile.owner, -10f, 0f);
}
}
}
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 OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
Player player = Main.player[projectile.owner];
if (projectile.Calamity().stealthStrike == true)
player.AddBuff(ModContent.BuffType<Mushy>(), 720);
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 623 B

+194
View File
@@ -0,0 +1,194 @@
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Rogue
{
public class ShroomerangSpore : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Spore");
}
public override void SetDefaults()
{
projectile.width = 12;
projectile.height = 12;
projectile.friendly = true;
projectile.alpha = 255;
projectile.penetrate = 1;
projectile.tileCollide = false;
projectile.ignoreWater = true;
projectile.timeLeft = 3600;
projectile.Calamity().rogue = true;
}
public override void AI()
{
Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.35f / 255f, (255 - projectile.alpha) * 0.5f / 255f);
projectile.localAI[0] += 1f;
if (projectile.localAI[0] >= 90f)
{
projectile.localAI[0] *= -1f;
}
if (projectile.localAI[0] >= 0f)
{
projectile.scale += 0.003f;
}
else
{
projectile.scale -= 0.003f;
}
projectile.rotation += 0.0025f * projectile.scale;
float num945 = 1f;
float num946 = 1f;
if (projectile.identity % 6 == 0)
{
num946 *= -1f;
}
if (projectile.identity % 6 == 1)
{
num945 *= -1f;
}
if (projectile.identity % 6 == 2)
{
num946 *= -1f;
num945 *= -1f;
}
if (projectile.identity % 6 == 3)
{
num946 = 0f;
}
if (projectile.identity % 6 == 4)
{
num945 = 0f;
}
projectile.localAI[1] += 1f;
if (projectile.localAI[1] > 60f)
{
projectile.localAI[1] = -180f;
}
if (projectile.localAI[1] >= -60f)
{
projectile.velocity.X = projectile.velocity.X + 0.002f * num946;
projectile.velocity.Y = projectile.velocity.Y + 0.002f * num945;
}
else
{
projectile.velocity.X = projectile.velocity.X - 0.002f * num946;
projectile.velocity.Y = projectile.velocity.Y - 0.002f * num945;
}
projectile.ai[0] += 1f;
if (projectile.ai[0] > 5400f)
{
projectile.damage = 0;
projectile.ai[1] = 1f;
if (projectile.alpha < 255)
{
projectile.alpha += 5;
if (projectile.alpha > 255)
{
projectile.alpha = 255;
}
}
else if (projectile.owner == Main.myPlayer)
{
projectile.Kill();
}
}
else
{
float num947 = (projectile.Center - Main.player[projectile.owner].Center).Length() / 100f;
if (num947 > 4f)
{
num947 *= 1.1f;
}
if (num947 > 5f)
{
num947 *= 1.2f;
}
if (num947 > 6f)
{
num947 *= 1.3f;
}
if (num947 > 7f)
{
num947 *= 1.4f;
}
if (num947 > 8f)
{
num947 *= 1.5f;
}
if (num947 > 9f)
{
num947 *= 1.6f;
}
if (num947 > 10f)
{
num947 *= 1.7f;
}
projectile.ai[0] += num947;
if (projectile.alpha > 50)
{
projectile.alpha -= 10;
if (projectile.alpha < 50)
{
projectile.alpha = 50;
}
}
}
bool flag49 = false;
Vector2 center12 = new Vector2(0f, 0f);
float num948 = 600f;
for (int num949 = 0; num949 < 200; num949++)
{
if (Main.npc[num949].CanBeChasedBy(projectile, false))
{
float num950 = Main.npc[num949].position.X + (float)(Main.npc[num949].width / 2);
float num951 = Main.npc[num949].position.Y + (float)(Main.npc[num949].height / 2);
float num952 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num950) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num951);
if (num952 < num948)
{
num948 = num952;
center12 = Main.npc[num949].Center;
flag49 = true;
}
}
}
if (flag49)
{
Vector2 vector101 = center12 - projectile.Center;
vector101.Normalize();
vector101 *= 0.75f;
projectile.velocity = (projectile.velocity * 10f + vector101) / 11f;
return;
}
if ((double)projectile.velocity.Length() > 0.2)
{
projectile.velocity *= 0.98f;
}
}
public override void Kill(int timeLeft)
{
projectile.position = projectile.Center;
projectile.width = projectile.height = 56;
projectile.position.X = projectile.position.X - (float)(projectile.width / 2);
projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2);
int num226 = 36;
for (int num227 = 0; num227 < num226; num227++)
{
Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f;
vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center;
Vector2 vector7 = vector6 - projectile.Center;
int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 56, vector7.X, vector7.Y, 100, default, 0.5f);
Main.dust[num228].noGravity = true;
Main.dust[num228].noLight = true;
Main.dust[num228].velocity = vector7;
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 277 B