added the shadow potion

This commit is contained in:
termigator1359 committed 2020-05-16 15:56:56 -04:00
1 parent cf678633d8
commit 0e34bab94f
12 files changed
+230 -6

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.Potions
{
public class ShadowBuff : ModBuff
{
public override void SetDefaults()
{
DisplayName.SetDefault("Shadow");
Description.SetDefault("You're invisible, certain rogue weapons give and gain buffs, and stealth generation is boosted.");
Main.debuff[Type] = false;
Main.pvpBuff[Type] = true;
Main.buffNoSave[Type] = false;
longerExpertDebuff = false;
}
public override void Update(Player player, ref int buffIndex)
{
player.invis = true;
player.Calamity().shadow = true;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 531 B

+9 -3
View File
@@ -720,6 +720,7 @@ namespace CalamityMod.CalPlayer
public bool bounding = false;
public bool triumph = false;
public bool penumbra = false;
public bool shadow = false;
public bool photosynthesis = false;
public bool astralInjection = false;
public bool gravityNormalizer = false;
@@ -1670,6 +1671,7 @@ namespace CalamityMod.CalPlayer
bounding = false;
triumph = false;
penumbra = false;
shadow = false;
photosynthesis = false;
astralInjection = false;
gravityNormalizer = false;
@@ -1999,6 +2001,7 @@ namespace CalamityMod.CalPlayer
bounding = false;
triumph = false;
penumbra = false;
shadow = false;
photosynthesis = false;
astralInjection = false;
gravityNormalizer = false;
@@ -5964,7 +5967,6 @@ namespace CalamityMod.CalPlayer
#endregion
#region Can Hit
public override bool? CanHitNPC(Item item, NPC target)
{
if (camper && ((double)Math.Abs(player.velocity.X) > 0.05 || (double)Math.Abs(player.velocity.Y) > 0.05))
@@ -5982,7 +5984,6 @@ namespace CalamityMod.CalPlayer
}
return null;
}
#endregion
#region Fishing
@@ -6044,7 +6045,7 @@ namespace CalamityMod.CalPlayer
num79 *= num80;
float speedX4 = num78 + (float)Main.rand.Next(-30, 31) * 0.02f;
float speedY5 = num79 + (float)Main.rand.Next(-30, 31) * 0.02f;
int p = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, (int)((float)damage * 0.15f), (int)(knockBack), player.whoAmI, 0f, (float)Main.rand.Next(15));
int p = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, (int)(damage * 0.15f), (int)(knockBack), player.whoAmI, 0f, (float)Main.rand.Next(15));
Main.projectile[p].knockBack /= 2;
Main.projectile[p].Calamity().forceRogue = true; //in case melee/rogue variants bug out
if (StealthStrikeAvailable())
@@ -9459,6 +9460,11 @@ namespace CalamityMod.CalPlayer
stealthGenStandstill += 0.08f;
stealthGenMoving += 0.08f;
}
if (shadow)
{
stealthGenStandstill += 0.1f;
stealthGenMoving += 0.1f;
}
if (etherealExtorter && Main.moonPhase == 3) // 3 = Waning Crescent
stealthGenStandstill += 0.15f;
+6
View File
@@ -2332,6 +2332,12 @@ namespace CalamityMod.CalPlayer
player.moveSpeed += 0.05f;
}
if (modPlayer.shadow)
{
if (player.FindBuffIndex(BuffID.Invisibility) > -1)
player.ClearBuff(BuffID.Invisibility);
}
if (modPlayer.irradiated)
{
if (modPlayer.boomerDukeLore)
+4
View File
@@ -769,6 +769,10 @@ namespace CalamityMod.Items
}
return true;
}
if (item.type == ItemID.InvisibilityPotion && player.FindBuffIndex(ModContent.BuffType<ShadowBuff>()) > -1)
{
return false;
}
if ((item.type == ItemID.RegenerationPotion || item.type == ItemID.LifeforcePotion) && player.FindBuffIndex(ModContent.BuffType<Cadence>()) > -1)
{
return false;
+55
View File
@@ -0,0 +1,55 @@
using CalamityMod.Buffs.Potions;
using CalamityMod.Items.Fishing.BrimstoneCragCatches;
using CalamityMod.Items.Materials;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Potions
{
public class ShadowPotion : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Shadow Potion");
Tooltip.SetDefault("Causes the player to disappear while not attacking\n" +
"Holding different types of rogue weapons give the player boosts\n" +
"Different types of rogue weapons spawn different projectiles on hit\n" +
"Stealth generation is increased by 10%");
}
public override void SetDefaults()
{
item.width = 28;
item.height = 18;
item.useTurn = true;
item.maxStack = 30;
item.rare = 3;
item.useAnimation = 17;
item.useTime = 17;
item.useStyle = 2;
item.UseSound = SoundID.Item3;
item.consumable = true;
item.buffType = ModContent.BuffType<ShadowBuff>();
item.buffTime = 18000; //5 minutes
item.value = Item.buyPrice(0, 2, 0, 0);
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ModContent.ItemType<Shadowfish>());
recipe.AddIngredient(ItemID.InvisibilityPotion);
recipe.AddIngredient(ItemID.BottledWater);
recipe.AddTile(TileID.Bottles);
recipe.SetResult(this, 2);
recipe.AddRecipe();
recipe = new ModRecipe(mod);
recipe.AddIngredient(ModContent.ItemType<BloodOrb>(), 10);
recipe.AddIngredient(ItemID.InvisibilityPotion);
recipe.AddTile(TileID.AlchemyTable);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 566 B

+70
View File
@@ -1382,6 +1382,76 @@ namespace CalamityMod.Projectiles
}
target.AddBuff(BuffID.Venom, 240);
}
if (modPlayer.shadow)
{
if (CalamityMod.javelinProjList.Contains(projectile.type))
{
int randrot = Main.rand.Next(-30, 391);
Vector2 SoulSpeed = new Vector2(13f, 13f).RotatedBy(MathHelper.ToRadians(randrot));
Projectile.NewProjectile(projectile.Center, SoulSpeed, ModContent.ProjectileType<PenumbraSoul>(), CalamityUtils.DamageSoftCap(projectile.damage * 0.1, 60), 3f, projectile.owner, 0f, 0f);
}
if (CalamityMod.spikyBallProjList.Contains(projectile.type))
{
int scythe = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType<CosmicScythe>(), CalamityUtils.DamageSoftCap(projectile.damage * 0.05, 60), 3f, projectile.owner, 0f, 0f);
Main.projectile[scythe].usesLocalNPCImmunity = true;
Main.projectile[scythe].localNPCHitCooldown = 10;
Main.projectile[scythe].penetrate = 2;
}
if (CalamityMod.daggerProjList.Contains(projectile.type))
{
Vector2 shardVelocity = new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f));
shardVelocity.Normalize();
shardVelocity *= 5f;
int shard = Projectile.NewProjectile(projectile.Center, shardVelocity, ModContent.ProjectileType<EquanimityDarkShard>(), CalamityUtils.DamageSoftCap(projectile.damage * 0.15, 60), 0f, projectile.owner);
Main.projectile[shard].timeLeft = 150;
}
if (CalamityMod.boomerangProjList.Contains(projectile.type))
{
int spiritDamage = CalamityUtils.DamageSoftCap(projectile.damage * 0.2, 60);
int[] numArray1 = new int[Main.maxNPCs];
int maxValue1 = 0;
int maxValue2 = 0;
for (int index = 0; index < Main.maxNPCs; ++index)
{
if (Main.npc[index].CanBeChasedBy((object)projectile, false))
{
float num2 = Math.Abs(Main.npc[index].Center.X - projectile.Center.X) + Math.Abs(Main.npc[index].Center.Y - projectile.Center.Y);
if (num2 < 800f)
{
if (Collision.CanHit(projectile.position, 1, 1, Main.npc[index].position, Main.npc[index].width, Main.npc[index].height) && num2 > 50f)
{
numArray1[maxValue2] = index;
++maxValue2;
}
else if (maxValue2 == 0)
{
numArray1[maxValue1] = index;
++maxValue1;
}
}
}
}
if (maxValue1 == 0 && maxValue2 == 0)
return;
int num3 = maxValue2 <= 0 ? numArray1[Main.rand.Next(maxValue1)] : numArray1[Main.rand.Next(maxValue2)];
double num4 = 4.0;
float num5 = (float)Main.rand.Next(-100, 101);
float num6 = (float)Main.rand.Next(-100, 101);
double num7 = Math.Sqrt((double)num5 * (double)num5 + (double)num6 * (double)num6);
float num8 = (float)(num4 / num7);
float SpeedX = num5 * num8;
float SpeedY = num6 * num8;
int ghost = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, SpeedX, SpeedY, ProjectileID.SpectreWrath, spiritDamage, 0f, projectile.owner, (float)num3, 0f);
Main.projectile[ghost].Calamity().forceRogue = true;
Main.projectile[ghost].penetrate = 1;
}
if (CalamityMod.flaskBombProjList.Contains(projectile.type))
{
int blackhole = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType<ShadowBlackhole>(), CalamityUtils.DamageSoftCap(projectile.damage * 0.05, 60), 3f, projectile.owner, 0f, 0f);
Main.projectile[blackhole].Center = projectile.Center;
}
}
}
else if (projectile.minion || projectile.sentry || CalamityMod.projectileMinionList.Contains(projectile.type) || ProjectileID.Sets.MinionShot[projectile.type] || ProjectileID.Sets.SentryShot[projectile.type])
{
-2
View File
@@ -11,7 +11,6 @@ namespace CalamityMod.Projectiles.Magic
{
private static float CosFrequency = 0.05f;
private static float CosAmplitude = 0.008f;
private static float RotationIncrement = 0.26f;
public int[] dustTypes = new int[]
{
ModContent.DustType<AstralBlue>(),
@@ -36,7 +35,6 @@ namespace CalamityMod.Projectiles.Magic
CosFrequency = 0.15f;
CosAmplitude = 0.06f;
RotationIncrement = 0.26f;
}
public override void AI()
+1 -1
View File
@@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Rogue
{
if (projectile.timeLeft > 350)
projectile.velocity *= 1.06f;
projectile.damage = (int) ((double)originalDamage * 1.25);
projectile.damage = (int)(originalDamage * 1.25);
CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 1500f, 20f, 20f);
}
}
+61
View File
@@ -0,0 +1,61 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Rogue
{
public class ShadowBlackhole : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Blackhole");
Main.projFrames[projectile.type] = 7;
}
public override void SetDefaults()
{
projectile.width = 88;
projectile.height = 90;
projectile.friendly = true;
projectile.penetrate = -1;
projectile.Calamity().rogue = true;
projectile.tileCollide = false;
projectile.usesIDStaticNPCImmunity = true;
projectile.idStaticNPCHitCooldown = 20;
}
public override void AI()
{
// Update animation
if (projectile.timeLeft % 5 == 0)
{
projectile.frame++;
}
if (projectile.frame >= Main.projFrames[projectile.type])
{
projectile.frame = 0;
}
projectile.ai[0]++;
if (projectile.ai[0] > 120f)
{
projectile.scale *= 0.95f;
projectile.Opacity *= 0.95f;
projectile.height = (int)(projectile.height * projectile.scale);
projectile.width = (int)(projectile.width * projectile.scale);
}
if (projectile.scale <= 0.05f)
{
projectile.Kill();
}
}
public override void OnHitPvp(Player target, int damage, bool crit)
{
target.AddBuff(BuffID.Blackout, 300);
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB