Tesla Potion
This commit is contained in:
1 parent
453f840c2a
commit
95c0f4deab
25 files changed
+294
-9
No files matched your search
@@ -0,0 +1,33 @@
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.Projectiles.Typeless;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Buffs.Potions
|
||||
{
|
||||
public class TeslaBuff : ModBuff
|
||||
{
|
||||
public override void SetDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Tesla's Electricity");
|
||||
Description.SetDefault("Summons an aura of electricity");
|
||||
Main.debuff[Type] = false;
|
||||
Main.pvpBuff[Type] = true;
|
||||
Main.buffNoSave[Type] = false;
|
||||
longerExpertDebuff = false;
|
||||
}
|
||||
|
||||
public override void Update(NPC npc, ref int buffIndex)
|
||||
{
|
||||
if (npc.Calamity().tesla < npc.buffTime[buffIndex])
|
||||
npc.Calamity().tesla = npc.buffTime[buffIndex];
|
||||
npc.DelBuff(buffIndex);
|
||||
buffIndex--;
|
||||
}
|
||||
|
||||
public override void Update(Player player, ref int buffIndex)
|
||||
{
|
||||
player.Calamity().tesla = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 741 B |
@@ -26,7 +26,7 @@ namespace CalamityMod.Buffs.StatDebuffs
|
||||
|
||||
/*public override void Update(Player player, ref int buffIndex)
|
||||
{
|
||||
player.GetCalamityPlayer().timeSlow = true;
|
||||
player.Calamity().timeSlow = true;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
@@ -584,6 +584,7 @@ namespace CalamityMod.CalPlayer
|
||||
public bool profanedRage = false;
|
||||
public bool draconicSurge = false;
|
||||
public int draconicSurgeCooldown = 0;
|
||||
public bool tesla = false;
|
||||
public bool vodka = false;
|
||||
public bool redWine = false;
|
||||
public bool grapeBeer = false;
|
||||
@@ -1299,6 +1300,7 @@ namespace CalamityMod.CalPlayer
|
||||
holyWrath = false;
|
||||
profanedRage = false;
|
||||
draconicSurge = false;
|
||||
tesla = false;
|
||||
trippy = false;
|
||||
amidiasBlessing = false;
|
||||
yPower = false;
|
||||
@@ -1546,6 +1548,7 @@ namespace CalamityMod.CalPlayer
|
||||
gravityNormalizer = false;
|
||||
holyWrath = false;
|
||||
profanedRage = false;
|
||||
tesla = false;
|
||||
draconicSurge = false;
|
||||
draconicSurgeCooldown = 0;
|
||||
yPower = false;
|
||||
|
||||
@@ -2693,6 +2693,29 @@ namespace CalamityMod.CalPlayer
|
||||
}
|
||||
}
|
||||
|
||||
if (modPlayer.tesla)
|
||||
{
|
||||
if (player.whoAmI == Main.myPlayer)
|
||||
{
|
||||
if (player.ownedProjectileCounts[ModContent.ProjectileType<TeslaAura>()] < 1)
|
||||
Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType<TeslaAura>(), 25, 0f, Main.myPlayer, 0f, 0f);
|
||||
}
|
||||
}
|
||||
else if (player.ownedProjectileCounts[ModContent.ProjectileType<TeslaAura>()] != 0)
|
||||
{
|
||||
if (player.whoAmI == Main.myPlayer)
|
||||
{
|
||||
for (int i = 0; i < 1000; i++)
|
||||
{
|
||||
if (Main.projectile[i].active && Main.projectile[i].type == ModContent.ProjectileType<TeslaAura>() && Main.projectile[i].owner == player.whoAmI)
|
||||
{
|
||||
Main.projectile[i].Kill();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Config.ProficiencyEnabled)
|
||||
modPlayer.GetStatBonuses();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
using CalamityMod.Buffs.Potions;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Items.Placeables;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Potions
|
||||
{
|
||||
public class TeslaPotion : ModItem
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Tesla Potion");
|
||||
Tooltip.SetDefault("Summons an aura of electricity that electrifies and slows enemies\n" +
|
||||
"Slowdown does not work on bosses");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
item.width = 24;
|
||||
item.height = 26;
|
||||
item.useTurn = true;
|
||||
item.maxStack = 999;
|
||||
item.rare = 3;
|
||||
item.useAnimation = 17;
|
||||
item.useTime = 17;
|
||||
item.useStyle = 2;
|
||||
item.UseSound = SoundID.Item3;
|
||||
item.consumable = true;
|
||||
item.buffType = ModContent.BuffType<TeslaBuff>();
|
||||
item.buffTime = 18000;
|
||||
item.value = Item.buyPrice(0, 2, 0, 0);
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
ModRecipe recipe = new ModRecipe(mod);
|
||||
recipe.AddIngredient(ItemID.BottledWater);
|
||||
recipe.AddIngredient(ModContent.ItemType<SeaPrism>());
|
||||
recipe.AddRecipeGroup("AnyGoldOre", 2);
|
||||
recipe.AddTile(TileID.Bottles);
|
||||
recipe.SetResult(this);
|
||||
recipe.AddRecipe();
|
||||
recipe = new ModRecipe(mod);
|
||||
recipe.AddIngredient(ItemID.BottledWater);
|
||||
recipe.AddIngredient(ModContent.ItemType<BloodOrb>(), 10);
|
||||
recipe.AddTile(TileID.AlchemyTable);
|
||||
recipe.SetResult(this);
|
||||
recipe.AddRecipe();
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 649 B |
@@ -3,6 +3,7 @@ using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Buffs.Placeables;
|
||||
using CalamityMod.Buffs.StatBuffs;
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Buffs.Potions;
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Items.Accessories;
|
||||
@@ -93,6 +94,7 @@ namespace CalamityMod.NPCs
|
||||
public int vaporfied = 0;
|
||||
public int timeSlow = 0;
|
||||
public int gState = 0;
|
||||
public int tesla = 0;
|
||||
public int tSad = 0;
|
||||
public int eFreeze = 0;
|
||||
public int silvaStun = 0;
|
||||
@@ -546,9 +548,9 @@ namespace CalamityMod.NPCs
|
||||
ApplyDPSDebuff(bBlood, 50, 10, ref npc.lifeRegen, ref damage);
|
||||
ApplyDPSDebuff(sulphurPoison, 180, 36, ref npc.lifeRegen, ref damage);
|
||||
if (npc.velocity.X == 0)
|
||||
ApplyDPSDebuff(electrified, 4, 2, ref npc.lifeRegen, ref damage);
|
||||
ApplyDPSDebuff(electrified, 10, 2, ref npc.lifeRegen, ref damage);
|
||||
else
|
||||
ApplyDPSDebuff(electrified, 16, 16, ref npc.lifeRegen, ref damage);
|
||||
ApplyDPSDebuff(electrified, 40, 8, ref npc.lifeRegen, ref damage);
|
||||
}
|
||||
|
||||
public void ApplyDPSDebuff(int debuff, int lifeRegenValue, int damageValue, ref int lifeRegen, ref int damage)
|
||||
@@ -614,9 +616,9 @@ namespace CalamityMod.NPCs
|
||||
npc.buffImmune[ModContent.BuffType<GlacialState>()] = true;
|
||||
npc.buffImmune[ModContent.BuffType<TemporalSadness>()] = true;
|
||||
npc.buffImmune[ModContent.BuffType<TimeSlow>()] = true;
|
||||
npc.buffImmune[ModContent.BuffType<TeslaBuff>()] = true;
|
||||
npc.buffImmune[BuffID.Webbed] = true;
|
||||
npc.buffImmune[BuffID.Slow] = true;
|
||||
npc.buffImmune[BuffID.Electrified] = true;
|
||||
}
|
||||
|
||||
if (DestroyerIDs.Contains(npc.type) || npc.type == NPCID.DD2EterniaCrystal || npc.townNPC)
|
||||
@@ -2115,6 +2117,8 @@ namespace CalamityMod.NPCs
|
||||
//Debuff decrements
|
||||
if (timeSlow > 0)
|
||||
timeSlow--;
|
||||
if (tesla > 0)
|
||||
tesla--;
|
||||
if (gState > 0)
|
||||
gState--;
|
||||
if (tSad > 0)
|
||||
@@ -2194,7 +2198,7 @@ namespace CalamityMod.NPCs
|
||||
npc.velocity = Vector2.Zero;
|
||||
else if (timeSlow > 0 || webbed > 0)
|
||||
npc.velocity *= 0.85f;
|
||||
else if (slowed > 0)
|
||||
else if (slowed > 0 || tesla > 0)
|
||||
npc.velocity *= 0.9f;
|
||||
}
|
||||
}
|
||||
@@ -3228,7 +3232,7 @@ namespace CalamityMod.NPCs
|
||||
drawColor = Color.White;
|
||||
}
|
||||
|
||||
if (timeSlow > 0)
|
||||
if (timeSlow > 0 || tesla > 0)
|
||||
{
|
||||
drawColor = Color.Aquamarine;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Buffs.Potions;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
@@ -37,6 +38,7 @@ namespace CalamityMod.NPCs.Perforator
|
||||
npc.alpha = 255;
|
||||
npc.buffImmune[ModContent.BuffType<GlacialState>()] = true;
|
||||
npc.buffImmune[ModContent.BuffType<TemporalSadness>()] = true;
|
||||
npc.buffImmune[ModContent.BuffType<TeslaBuff>()] = true;
|
||||
npc.buffImmune[BuffID.Slow] = true;
|
||||
npc.buffImmune[BuffID.Webbed] = true;
|
||||
npc.behindTiles = true;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Buffs.Potions;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
@@ -36,6 +37,7 @@ namespace CalamityMod.NPCs.Perforator
|
||||
npc.alpha = 255;
|
||||
npc.buffImmune[ModContent.BuffType<GlacialState>()] = true;
|
||||
npc.buffImmune[ModContent.BuffType<TemporalSadness>()] = true;
|
||||
npc.buffImmune[ModContent.BuffType<TeslaBuff>()] = true;
|
||||
npc.buffImmune[BuffID.Slow] = true;
|
||||
npc.buffImmune[BuffID.Webbed] = true;
|
||||
npc.behindTiles = true;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Buffs.Potions;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
@@ -36,6 +37,7 @@ namespace CalamityMod.NPCs.Perforator
|
||||
npc.alpha = 255;
|
||||
npc.buffImmune[ModContent.BuffType<GlacialState>()] = true;
|
||||
npc.buffImmune[ModContent.BuffType<TemporalSadness>()] = true;
|
||||
npc.buffImmune[ModContent.BuffType<TeslaBuff>()] = true;
|
||||
npc.buffImmune[BuffID.Slow] = true;
|
||||
npc.buffImmune[BuffID.Webbed] = true;
|
||||
npc.behindTiles = true;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Buffs.Potions;
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.World;
|
||||
@@ -44,6 +45,7 @@ namespace CalamityMod.NPCs.Perforator
|
||||
npc.alpha = 255;
|
||||
npc.buffImmune[ModContent.BuffType<GlacialState>()] = true;
|
||||
npc.buffImmune[ModContent.BuffType<TemporalSadness>()] = true;
|
||||
npc.buffImmune[ModContent.BuffType<TeslaBuff>()] = true;
|
||||
npc.buffImmune[BuffID.Slow] = true;
|
||||
npc.buffImmune[BuffID.Webbed] = true;
|
||||
npc.behindTiles = true;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Buffs.Potions;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
@@ -44,6 +45,7 @@ namespace CalamityMod.NPCs.Perforator
|
||||
npc.alpha = 255;
|
||||
npc.buffImmune[ModContent.BuffType<GlacialState>()] = true;
|
||||
npc.buffImmune[ModContent.BuffType<TemporalSadness>()] = true;
|
||||
npc.buffImmune[ModContent.BuffType<TeslaBuff>()] = true;
|
||||
npc.buffImmune[BuffID.Slow] = true;
|
||||
npc.buffImmune[BuffID.Webbed] = true;
|
||||
npc.behindTiles = true;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Buffs.Potions;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
@@ -42,6 +43,7 @@ namespace CalamityMod.NPCs.Perforator
|
||||
npc.alpha = 255;
|
||||
npc.buffImmune[ModContent.BuffType<GlacialState>()] = true;
|
||||
npc.buffImmune[ModContent.BuffType<TemporalSadness>()] = true;
|
||||
npc.buffImmune[ModContent.BuffType<TeslaBuff>()] = true;
|
||||
npc.buffImmune[BuffID.Slow] = true;
|
||||
npc.buffImmune[BuffID.Webbed] = true;
|
||||
npc.behindTiles = true;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Buffs.Potions;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
@@ -34,6 +35,7 @@ namespace CalamityMod.NPCs.Perforator
|
||||
npc.alpha = 255;
|
||||
npc.buffImmune[ModContent.BuffType<GlacialState>()] = true;
|
||||
npc.buffImmune[ModContent.BuffType<TemporalSadness>()] = true;
|
||||
npc.buffImmune[ModContent.BuffType<TeslaBuff>()] = true;
|
||||
npc.buffImmune[BuffID.Slow] = true;
|
||||
npc.buffImmune[BuffID.Webbed] = true;
|
||||
npc.behindTiles = true;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Buffs.Potions;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
@@ -34,6 +35,7 @@ namespace CalamityMod.NPCs.Perforator
|
||||
npc.alpha = 255;
|
||||
npc.buffImmune[ModContent.BuffType<GlacialState>()] = true;
|
||||
npc.buffImmune[ModContent.BuffType<TemporalSadness>()] = true;
|
||||
npc.buffImmune[ModContent.BuffType<TeslaBuff>()] = true;
|
||||
npc.buffImmune[BuffID.Slow] = true;
|
||||
npc.buffImmune[BuffID.Webbed] = true;
|
||||
npc.behindTiles = true;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Buffs.Potions;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
@@ -35,6 +36,7 @@ namespace CalamityMod.NPCs.Perforator
|
||||
npc.alpha = 255;
|
||||
npc.buffImmune[ModContent.BuffType<GlacialState>()] = true;
|
||||
npc.buffImmune[ModContent.BuffType<TemporalSadness>()] = true;
|
||||
npc.buffImmune[ModContent.BuffType<TeslaBuff>()] = true;
|
||||
npc.buffImmune[BuffID.Slow] = true;
|
||||
npc.buffImmune[BuffID.Webbed] = true;
|
||||
npc.behindTiles = true;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Buffs.Potions;
|
||||
using CalamityMod.Items.TreasureBags;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using CalamityMod.World;
|
||||
@@ -34,6 +35,7 @@ namespace CalamityMod.NPCs.SlimeGod
|
||||
aiType = -1;
|
||||
npc.buffImmune[ModContent.BuffType<GlacialState>()] = true;
|
||||
npc.buffImmune[ModContent.BuffType<TemporalSadness>()] = true;
|
||||
npc.buffImmune[ModContent.BuffType<TeslaBuff>()] = true;
|
||||
npc.buffImmune[BuffID.Slow] = true;
|
||||
npc.buffImmune[BuffID.Webbed] = true;
|
||||
npc.knockBackResist = 0f;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Buffs.Potions;
|
||||
using CalamityMod.Items.TreasureBags;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using CalamityMod.World;
|
||||
@@ -34,6 +35,7 @@ namespace CalamityMod.NPCs.SlimeGod
|
||||
animationType = 50;
|
||||
npc.buffImmune[ModContent.BuffType<GlacialState>()] = true;
|
||||
npc.buffImmune[ModContent.BuffType<TemporalSadness>()] = true;
|
||||
npc.buffImmune[ModContent.BuffType<TeslaBuff>()] = true;
|
||||
npc.buffImmune[BuffID.Slow] = true;
|
||||
npc.buffImmune[BuffID.Webbed] = true;
|
||||
npc.value = 0f;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Buffs.Potions;
|
||||
using CalamityMod.Items.TreasureBags;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using CalamityMod.World;
|
||||
@@ -33,6 +34,7 @@ namespace CalamityMod.NPCs.SlimeGod
|
||||
npc.knockBackResist = 0f;
|
||||
npc.buffImmune[ModContent.BuffType<GlacialState>()] = true;
|
||||
npc.buffImmune[ModContent.BuffType<TemporalSadness>()] = true;
|
||||
npc.buffImmune[ModContent.BuffType<TeslaBuff>()] = true;
|
||||
npc.buffImmune[BuffID.Slow] = true;
|
||||
npc.buffImmune[BuffID.Webbed] = true;
|
||||
animationType = 50;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Buffs.Potions;
|
||||
using CalamityMod.Items.TreasureBags;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using CalamityMod.World;
|
||||
@@ -35,6 +36,7 @@ namespace CalamityMod.NPCs.SlimeGod
|
||||
npc.knockBackResist = 0f;
|
||||
npc.buffImmune[ModContent.BuffType<GlacialState>()] = true;
|
||||
npc.buffImmune[ModContent.BuffType<TemporalSadness>()] = true;
|
||||
npc.buffImmune[ModContent.BuffType<TeslaBuff>()] = true;
|
||||
npc.buffImmune[BuffID.Slow] = true;
|
||||
npc.buffImmune[BuffID.Webbed] = true;
|
||||
animationType = 50;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
using CalamityMod.NPCs;
|
||||
using CalamityMod.NPCs;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.NPCs;
|
||||
using CalamityMod.Buffs.Potions;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Typeless
|
||||
{
|
||||
public class TeslaAura : ModProjectile
|
||||
{
|
||||
private const float radius = 98f;
|
||||
private const int framesX = 3;
|
||||
private const int framesY = 6;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Tesla's Electricity");
|
||||
ProjectileID.Sets.MinionSacrificable[projectile.type] = true;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 218;
|
||||
projectile.height = 218;
|
||||
projectile.ignoreWater = true;
|
||||
projectile.minionSlots = 0f;
|
||||
projectile.timeLeft = 18000;
|
||||
projectile.tileCollide = false;
|
||||
projectile.friendly = true;
|
||||
projectile.timeLeft *= 5;
|
||||
projectile.penetrate = -1;
|
||||
projectile.usesLocalNPCImmunity = true;
|
||||
projectile.localNPCHitCooldown = 20;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
projectile.frameCounter++;
|
||||
if (projectile.frameCounter > 3)
|
||||
{
|
||||
projectile.localAI[0]++;
|
||||
projectile.frameCounter = 0;
|
||||
}
|
||||
if (projectile.localAI[0] >= framesY)
|
||||
{
|
||||
projectile.localAI[0] = 0;
|
||||
projectile.localAI[1]++;
|
||||
}
|
||||
if (projectile.localAI[1] >= framesX)
|
||||
{
|
||||
projectile.localAI[1] = 0;
|
||||
}
|
||||
Player player = Main.player[projectile.owner];
|
||||
Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0.01f / 255f);
|
||||
projectile.Center = player.Center;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
if (CalamityGlobalNPC.ShouldAffectNPC(target))
|
||||
{
|
||||
float knockbackMultiplier = knockback - target.knockBackResist;
|
||||
if (knockbackMultiplier < 0)
|
||||
{
|
||||
knockbackMultiplier = 0;
|
||||
}
|
||||
Vector2 trueKnockback = target.Center - projectile.Center;
|
||||
trueKnockback.Normalize();
|
||||
target.velocity = trueKnockback * knockbackMultiplier;
|
||||
}
|
||||
|
||||
target.AddBuff(BuffID.Electrified, 300);
|
||||
target.AddBuff(ModContent.BuffType<TeslaBuff>(), 120);
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
Texture2D sprite = Main.projectileTexture[projectile.type];
|
||||
|
||||
Color drawColour = Color.White;
|
||||
Rectangle sourceRect = new Rectangle(projectile.width * (int)projectile.localAI[1], projectile.height * (int)projectile.localAI[0], projectile.width, projectile.height);
|
||||
Vector2 origin = new Vector2(projectile.width / 2, projectile.height / 2);
|
||||
|
||||
float opacity = 1f;
|
||||
int sparkCount = 0;
|
||||
int fadeTime = 20;
|
||||
|
||||
if (projectile.timeLeft < fadeTime)
|
||||
{
|
||||
opacity = projectile.timeLeft * (1f / fadeTime);
|
||||
sparkCount = fadeTime - projectile.timeLeft;
|
||||
}
|
||||
|
||||
for (int i = 0; i < sparkCount * 2; i++)
|
||||
{
|
||||
int dustType = 132;
|
||||
if (Main.rand.NextBool())
|
||||
{
|
||||
dustType = 264;
|
||||
}
|
||||
float rangeDiff = 2f;
|
||||
|
||||
Vector2 dustPos = new Vector2(Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1));
|
||||
dustPos.Normalize();
|
||||
dustPos *= radius + Main.rand.NextFloat(-rangeDiff, rangeDiff);
|
||||
|
||||
int dust = Dust.NewDust(projectile.Center + dustPos, 1, 1, dustType, 0, 0, 0, default, 0.75f);
|
||||
Main.dust[dust].noGravity = true;
|
||||
}
|
||||
|
||||
spriteBatch.Draw(sprite, projectile.Center - Main.screenPosition, sourceRect, drawColour * opacity, projectile.rotation, origin, 1f, SpriteEffects.None, 0f);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
|
||||
{
|
||||
float dist1 = Vector2.Distance(projectile.Center, targetHitbox.TopLeft());
|
||||
float dist2 = Vector2.Distance(projectile.Center, targetHitbox.TopRight());
|
||||
float dist3 = Vector2.Distance(projectile.Center, targetHitbox.BottomLeft());
|
||||
float dist4 = Vector2.Distance(projectile.Center, targetHitbox.BottomRight());
|
||||
|
||||
float minDist = dist1;
|
||||
if (dist2 < minDist)
|
||||
minDist = dist2;
|
||||
if (dist3 < minDist)
|
||||
minDist = dist3;
|
||||
if (dist4 < minDist)
|
||||
minDist = dist4;
|
||||
|
||||
return minDist <= radius;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 48 KiB |
@@ -746,6 +746,13 @@ namespace CalamityMod
|
||||
});
|
||||
RecipeGroup.RegisterGroup("AnyCopperBar", group);
|
||||
|
||||
group = new RecipeGroup(() => "Any Gold Ore", new int[]
|
||||
{
|
||||
ItemID.GoldOre,
|
||||
ItemID.PlatinumOre
|
||||
});
|
||||
RecipeGroup.RegisterGroup("AnyGoldOre", group);
|
||||
|
||||
group = new RecipeGroup(() => "Any Gold Bar", new int[]
|
||||
{
|
||||
ItemID.GoldBar,
|
||||
@@ -781,7 +788,7 @@ namespace CalamityMod
|
||||
});
|
||||
RecipeGroup.RegisterGroup("NForEE", group);
|
||||
|
||||
group = new RecipeGroup(() => "Fetid or Bloodletting Essence", new int[]
|
||||
group = new RecipeGroup(() => "Any Evil Essence", new int[]
|
||||
{
|
||||
ModContent.ItemType<FetidEssence>(),
|
||||
ModContent.ItemType<BloodlettingEssence>()
|
||||
|
||||
Reference in new issue
Block a user