added gastric belcher staff
No files matched your search
@@ -0,0 +1,36 @@
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.Projectiles.Summon;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Buffs.Summon
|
||||
{
|
||||
public class GastricBelcherBuff : ModBuff
|
||||
{
|
||||
public override void SetDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Gastric Aberration");
|
||||
Description.SetDefault("The aquatic aberration will protect you");
|
||||
Main.buffNoTimeDisplay[Type] = true;
|
||||
Main.buffNoSave[Type] = true;
|
||||
}
|
||||
|
||||
public override void Update(Player player, ref int buffIndex)
|
||||
{
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
if (player.ownedProjectileCounts[ModContent.ProjectileType<GastricBelcher>()] > 0)
|
||||
{
|
||||
modPlayer.gastricBelcher = true;
|
||||
}
|
||||
if (!modPlayer.gastricBelcher)
|
||||
{
|
||||
player.DelBuff(buffIndex);
|
||||
buffIndex--;
|
||||
}
|
||||
else
|
||||
{
|
||||
player.buffTime[buffIndex] = 18000;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 752 B |
@@ -843,6 +843,7 @@ namespace CalamityMod.CalPlayer
|
||||
public bool rDevil = false;
|
||||
public bool aValkyrie = false;
|
||||
public bool apexShark = false;
|
||||
public bool gastricBelcher = false;
|
||||
public bool squirrel = false;
|
||||
public bool hauntedDishes = false;
|
||||
public bool stormjaw = false;
|
||||
@@ -1790,6 +1791,7 @@ namespace CalamityMod.CalPlayer
|
||||
eAxe = false;
|
||||
endoCooper = false;
|
||||
apexShark = false;
|
||||
gastricBelcher = false;
|
||||
squirrel = false;
|
||||
hauntedDishes = false;
|
||||
stormjaw = false;
|
||||
|
||||
@@ -4,6 +4,7 @@ using CalamityMod.Items.Weapons.Magic;
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.Items.Weapons.Ranged;
|
||||
using CalamityMod.Items.Weapons.Rogue;
|
||||
using CalamityMod.Items.Weapons.Summon;
|
||||
using CalamityMod.NPCs.Leviathan;
|
||||
using CalamityMod.World;
|
||||
using Terraria;
|
||||
@@ -52,6 +53,7 @@ namespace CalamityMod.Items.TreasureBags
|
||||
DropHelper.DropItemChance(player, ModContent.ItemType<Atlantis>(), 3);
|
||||
DropHelper.DropItemChance(player, ModContent.ItemType<BrackishFlask>(), 3);
|
||||
DropHelper.DropItemChance(player, ModContent.ItemType<LeviathanTeeth>(), 3);
|
||||
DropHelper.DropItemChance(player, ModContent.ItemType<GastricBelcherStaff>(), 3);
|
||||
|
||||
// Equipment
|
||||
DropHelper.DropItem(player, ModContent.ItemType<LeviathanAmbergris>());
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
using CalamityMod.Projectiles.Summon;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Summon
|
||||
{
|
||||
public class GastricBelcherStaff : ModItem
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Gastric Belcher Staff");
|
||||
Tooltip.SetDefault("Summons aquatic aberrations to protect you\n" +
|
||||
"Aberrations fire vomit at nearby enemies with every third attack firing bubbles");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
item.damage = 70;
|
||||
item.mana = 10;
|
||||
item.width = 66;
|
||||
item.height = 70;
|
||||
item.useTime = item.useAnimation = 20;
|
||||
item.useStyle = 1;
|
||||
item.noMelee = true;
|
||||
item.knockBack = 1f;
|
||||
item.value = CalamityGlobalItem.Rarity7BuyPrice;
|
||||
item.rare = 7;
|
||||
item.UseSound = SoundID.Item76;
|
||||
item.shoot = ModContent.ProjectileType<GastricBelcher>();
|
||||
item.shootSpeed = 10f;
|
||||
item.summon = true;
|
||||
item.autoReuse = 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.altFunctionUse != 2)
|
||||
{
|
||||
player.itemTime = item.useTime;
|
||||
Vector2 playerPos = player.RotatedRelativePoint(player.MountedCenter, true);
|
||||
float directionX = Main.mouseX + Main.screenPosition.X - playerPos.X;
|
||||
float directionY = Main.mouseY + Main.screenPosition.Y - playerPos.Y;
|
||||
if (player.gravDir == -1f)
|
||||
{
|
||||
directionY = Main.screenPosition.Y + Main.screenHeight - Main.mouseY - playerPos.Y;
|
||||
}
|
||||
Vector2 spinningpoint = new Vector2(directionX, directionY);
|
||||
float dist = spinningpoint.Length();
|
||||
if ((float.IsNaN(spinningpoint.X) && float.IsNaN(spinningpoint.Y)) || (spinningpoint.X == 0f && spinningpoint.Y == 0f))
|
||||
{
|
||||
spinningpoint.X = player.direction;
|
||||
spinningpoint.Y = 0f;
|
||||
dist = item.shootSpeed;
|
||||
}
|
||||
else
|
||||
{
|
||||
dist = item.shootSpeed / dist;
|
||||
}
|
||||
spinningpoint.X *= dist;
|
||||
spinningpoint.Y *= dist;
|
||||
playerPos.X = Main.mouseX + Main.screenPosition.X;
|
||||
playerPos.Y = Main.mouseY + Main.screenPosition.Y;
|
||||
spinningpoint = spinningpoint.RotatedBy(Math.PI / 2D, default);
|
||||
Projectile.NewProjectile(playerPos + spinningpoint, spinningpoint, type, damage, knockBack, player.whoAmI, 0f, 1f);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
@@ -344,7 +344,7 @@ namespace CalamityMod
|
||||
{
|
||||
BossDifficulty.TryGetValue("Leviathan", out float order);
|
||||
List<int> bosses = new List<int>() { NPCType<Leviathan>(), NPCType<Siren>() };
|
||||
List<int> loot = new List<int>() { ItemType<LeviathanBag>(), ItemType<Greentide>(), ItemType<Leviatitan>(), ItemType<SirensSong>(), ItemType<Atlantis>(), ItemType<BrackishFlask>(), ItemType<LeviathanTeeth>(), ItemType<LureofEnthrallment>(), ItemType<LeviathanAmbergris>(), ItemType<TheCommunity>(), ItemID.HotlineFishingHook, ItemID.BottomlessBucket, ItemID.SuperAbsorbantSponge, ItemID.FishingPotion, ItemID.SonarPotion, ItemID.CratePotion, ItemID.GreaterHealingPotion };
|
||||
List<int> loot = new List<int>() { ItemType<LeviathanBag>(), ItemType<Greentide>(), ItemType<Leviatitan>(), ItemType<SirensSong>(), ItemType<Atlantis>(), ItemType<GastricBelcherStaff>(), ItemType<BrackishFlask>(), ItemType<LeviathanTeeth>(), ItemType<LureofEnthrallment>(), ItemType<LeviathanAmbergris>(), ItemType<TheCommunity>(), ItemID.HotlineFishingHook, ItemID.BottomlessBucket, ItemID.SuperAbsorbantSponge, ItemID.FishingPotion, ItemID.SonarPotion, ItemID.CratePotion, ItemID.GreaterHealingPotion };
|
||||
List<int> collection = new List<int>() { ItemType<LeviathanTrophy>(), ItemType<LeviathanMask>(), ItemType<KnowledgeOcean>(), ItemType<KnowledgeLeviathanandSiren>() };
|
||||
string instructions = "By killing an unknown entity in the Ocean Biome";
|
||||
string despawn = CalamityUtils.ColorMessage("The aquatic entities sink back beneath the ocean depths.", new Color(0x7F, 0xFF, 0xD4));
|
||||
@@ -844,6 +844,7 @@ namespace CalamityMod
|
||||
//Entropy's Vigil is a bruh moment
|
||||
sAssociation.Call("AddMinionInfo", ItemType<PlantationStaff>(), BuffType<PlantationBuff>(), ProjectileType<PlantSummon>());
|
||||
sAssociation.Call("AddMinionInfo", ItemType<SandSharknadoStaff>(), BuffType<Sandnado>(), ProjectileType<SandnadoMinion>());
|
||||
sAssociation.Call("AddMinionInfo", ItemType<GastricBelcherStaff>(), BuffType<GastricBelcherBuff>(), ProjectileType<GastricBelcher>());
|
||||
sAssociation.Call("AddMinionInfo", ItemType<ResurrectionButterfly>(), BuffType<ResurrectionButterflyBuff>(), new List<int>() { ProjectileType<PinkButterfly>(), ProjectileType<PurpleButterfly>()});
|
||||
sAssociation.Call("AddMinionInfo", ItemType<FuelCellBundle>(), BuffType<FuelCellBundleBuff>(), ProjectileType<PlaguebringerMK2>());
|
||||
sAssociation.Call("AddMinionInfo", ItemType<GodspawnHelixStaff>(), BuffType<AstralProbeBuff>(), ProjectileType<AstralProbeSummon>());
|
||||
|
||||
@@ -9,6 +9,7 @@ using CalamityMod.Items.Weapons.Magic;
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.Items.Weapons.Ranged;
|
||||
using CalamityMod.Items.Weapons.Rogue;
|
||||
using CalamityMod.Items.Weapons.Summon;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
@@ -627,6 +628,7 @@ namespace CalamityMod.NPCs.Leviathan
|
||||
DropHelper.DropItemChance(npc, ModContent.ItemType<Atlantis>(), 4);
|
||||
DropHelper.DropItemChance(npc, ModContent.ItemType<BrackishFlask>(), 4);
|
||||
DropHelper.DropItemChance(npc, ModContent.ItemType<LeviathanTeeth>(), 4);
|
||||
DropHelper.DropItemChance(npc, ModContent.ItemType<GastricBelcherStaff>(), 4);
|
||||
|
||||
// Equipment
|
||||
DropHelper.DropItemChance(npc, ModContent.ItemType<LureofEnthrallment>(), 4);
|
||||
|
||||
@@ -0,0 +1,352 @@
|
||||
using CalamityMod.Buffs.Summon;
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.Projectiles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Summon
|
||||
{
|
||||
public class GastricBelcher : ModProjectile
|
||||
{
|
||||
private bool initialized = false;
|
||||
private int bubbleCounter = 0;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Gastric Belcher");
|
||||
Main.projFrames[projectile.type] = 4;
|
||||
ProjectileID.Sets.MinionSacrificable[projectile.type] = true;
|
||||
ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 40;
|
||||
projectile.height = 40;
|
||||
projectile.netImportant = true;
|
||||
projectile.friendly = true;
|
||||
projectile.ignoreWater = true;
|
||||
projectile.minionSlots = 1f;
|
||||
projectile.timeLeft = 18000;
|
||||
projectile.penetrate = -1;
|
||||
projectile.tileCollide = false;
|
||||
projectile.timeLeft *= 5;
|
||||
projectile.minion = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
//Set namespaces
|
||||
Player player = Main.player[projectile.owner];
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
CalamityGlobalProjectile modProj = projectile.Calamity();
|
||||
|
||||
//On spawn effects
|
||||
if (!initialized)
|
||||
{
|
||||
//Set constants
|
||||
modProj.spawnedPlayerMinionDamageValue = player.MinionDamage();
|
||||
modProj.spawnedPlayerMinionProjectileDamageValue = projectile.damage;
|
||||
//Spawn dust
|
||||
int dustAmt = 36;
|
||||
for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++)
|
||||
{
|
||||
int randomDust = Utils.SelectRandom(Main.rand, new int[]
|
||||
{
|
||||
33,
|
||||
89
|
||||
});
|
||||
Vector2 direction = Vector2.Normalize(projectile.velocity) * new Vector2(projectile.width / 2f, projectile.height) * 0.75f;
|
||||
direction = direction.RotatedBy((double)((dustIndex - (dustAmt / 2f - 1f)) * MathHelper.TwoPi / dustAmt), default) + projectile.Center;
|
||||
Vector2 dustVel = direction - projectile.Center;
|
||||
int water = Dust.NewDust(direction + dustVel, 0, 0, randomDust, dustVel.X * 1.75f, dustVel.Y * 1.75f, 100, default, 1.1f);
|
||||
Main.dust[water].noGravity = true;
|
||||
Main.dust[water].velocity = dustVel;
|
||||
}
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
//Flexible minion damage update
|
||||
if (player.MinionDamage() != modProj.spawnedPlayerMinionDamageValue)
|
||||
{
|
||||
int damage2 = (int)(modProj.spawnedPlayerMinionProjectileDamageValue /
|
||||
modProj.spawnedPlayerMinionDamageValue * player.MinionDamage());
|
||||
projectile.damage = damage2;
|
||||
}
|
||||
|
||||
//Update frames
|
||||
if (projectile.frameCounter++ % 6 == 0)
|
||||
{
|
||||
projectile.frame++;
|
||||
}
|
||||
if (projectile.frame >= Main.projFrames[projectile.type])
|
||||
{
|
||||
projectile.frame = 0;
|
||||
}
|
||||
|
||||
//Set up buff and timeLeft
|
||||
bool typeCheck = projectile.type == ModContent.ProjectileType<GastricBelcher>();
|
||||
player.AddBuff(ModContent.BuffType<GastricBelcherBuff>(), 3600);
|
||||
if (typeCheck)
|
||||
{
|
||||
if (player.dead)
|
||||
{
|
||||
modPlayer.gastricBelcher = false;
|
||||
}
|
||||
if (modPlayer.gastricBelcher)
|
||||
{
|
||||
projectile.timeLeft = 2;
|
||||
}
|
||||
}
|
||||
|
||||
//Anti sticky movement to prevent overlapping minions
|
||||
float antiStickMvt = 0.05f;
|
||||
for (int projIndex = 0; projIndex < Main.maxProjectiles; projIndex++)
|
||||
{
|
||||
Projectile proj = Main.projectile[projIndex];
|
||||
bool correctMinion = proj.type == ModContent.ProjectileType<GastricBelcher>();
|
||||
if (projIndex != projectile.whoAmI && proj.active && proj.owner == projectile.owner && correctMinion && Math.Abs(projectile.position.X - proj.position.X) + Math.Abs(projectile.position.Y - proj.position.Y) < projectile.width)
|
||||
{
|
||||
if (projectile.position.X < proj.position.X)
|
||||
{
|
||||
projectile.velocity.X -= antiStickMvt;
|
||||
}
|
||||
else
|
||||
{
|
||||
projectile.velocity.X += antiStickMvt;
|
||||
}
|
||||
if (projectile.position.Y < proj.position.Y)
|
||||
{
|
||||
projectile.velocity.Y -= antiStickMvt;
|
||||
}
|
||||
else
|
||||
{
|
||||
projectile.velocity.Y += antiStickMvt;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Find a target
|
||||
float maxDistance = 700f;
|
||||
Vector2 targetVec = projectile.position;
|
||||
Vector2 half = new Vector2(0.5f);
|
||||
bool foundTarget = false;
|
||||
//If targeting something, prioritize that enemy
|
||||
if (player.HasMinionAttackTargetNPC)
|
||||
{
|
||||
NPC npc = Main.npc[player.MinionAttackTargetNPC];
|
||||
if (npc.CanBeChasedBy(projectile, false))
|
||||
{
|
||||
//Adding a check on the NPC's size allows it to target big things like Providence
|
||||
Vector2 sizeCheck = npc.position + npc.Size * half;
|
||||
//Check if blocks are in the way
|
||||
bool collisionCheck = Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height);
|
||||
//Calculate distance between target and the projectile to know if it's too far or not
|
||||
float targetDist = Vector2.Distance(npc.Center, projectile.Center);
|
||||
if (!foundTarget && targetDist < maxDistance && collisionCheck)
|
||||
{
|
||||
maxDistance = targetDist;
|
||||
targetVec = sizeCheck;
|
||||
foundTarget = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++)
|
||||
{
|
||||
NPC npc = Main.npc[npcIndex];
|
||||
if (npc.CanBeChasedBy(projectile, false))
|
||||
{
|
||||
Vector2 sizeCheck = npc.position + npc.Size * half;
|
||||
bool collisionCheck = Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height);
|
||||
float targetDist = Vector2.Distance(npc.Center, projectile.Center);
|
||||
if (!foundTarget && targetDist < maxDistance && collisionCheck)
|
||||
{
|
||||
maxDistance = targetDist;
|
||||
targetVec = sizeCheck;
|
||||
foundTarget = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//If too far, make the minion start returning to the player.
|
||||
float returnDist = 1000f;
|
||||
if (foundTarget)
|
||||
{
|
||||
//Max travel distance increases if targeting something
|
||||
returnDist = 2200f;
|
||||
}
|
||||
if (Vector2.Distance(player.Center, projectile.Center) > returnDist)
|
||||
{
|
||||
projectile.ai[0] = 1f;
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
|
||||
//If a target is found, move toward it
|
||||
if (foundTarget && projectile.ai[0] == 0f)
|
||||
{
|
||||
Vector2 vecToTarget = targetVec - projectile.Center;
|
||||
float targetDist = vecToTarget.Length();
|
||||
vecToTarget.Normalize();
|
||||
//If farther than 200 pixels, move toward it
|
||||
if (targetDist > 200f)
|
||||
{
|
||||
float speedMult = (targetDist > 400f) ? 12f : (targetDist > 250) ? 6f : 3f;
|
||||
vecToTarget *= speedMult;
|
||||
projectile.velocity = (projectile.velocity * 40f + vecToTarget) / 41f;
|
||||
}
|
||||
//Otherwise, back it up slowly
|
||||
else
|
||||
{
|
||||
float speedMult = -3f;
|
||||
vecToTarget *= speedMult;
|
||||
projectile.velocity = (projectile.velocity * 40f + vecToTarget) / 41f;
|
||||
}
|
||||
}
|
||||
|
||||
//If not targeting something, act passively
|
||||
else
|
||||
{
|
||||
bool returningToPlayer = false;
|
||||
if (!returningToPlayer)
|
||||
{
|
||||
returningToPlayer = projectile.ai[0] == 1f;
|
||||
}
|
||||
//Move faster if actively returning to the player
|
||||
float speedMult = 10f;
|
||||
if (returningToPlayer)
|
||||
{
|
||||
speedMult = 21f;
|
||||
}
|
||||
Vector2 vecToPlayer = player.Center - projectile.Center + new Vector2(0f, -60f);
|
||||
float playerDist = vecToPlayer.Length();
|
||||
//Slow down if near the player
|
||||
if (playerDist < 200f && speedMult > 8f)
|
||||
{
|
||||
speedMult = 1f;
|
||||
}
|
||||
//If close enough to the player, return to normal
|
||||
if (playerDist < 150f && returningToPlayer && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height))
|
||||
{
|
||||
projectile.ai[0] = 0f;
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
//If abnormally far, teleport to the player
|
||||
if (playerDist > 2000f)
|
||||
{
|
||||
projectile.position.X = player.Center.X - (projectile.width / 2f);
|
||||
projectile.position.Y = player.Center.Y - (projectile.height / 2f);
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
//Move toward player if more than 70 pixels away
|
||||
if (playerDist > 70f)
|
||||
{
|
||||
vecToPlayer.Normalize();
|
||||
vecToPlayer *= speedMult;
|
||||
projectile.velocity = (projectile.velocity * 40f + vecToPlayer) / 41f;
|
||||
}
|
||||
//Move if still
|
||||
else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f)
|
||||
{
|
||||
projectile.velocity.X = -0.15f;
|
||||
projectile.velocity.Y = -0.05f;
|
||||
}
|
||||
}
|
||||
|
||||
//Update sprite direction and rotation
|
||||
if (foundTarget)
|
||||
{
|
||||
projectile.spriteDirection = projectile.direction = ((targetVec.X - projectile.Center.X) > 0).ToDirectionInt();
|
||||
projectile.rotation = projectile.rotation.AngleTowards(projectile.AngleTo(targetVec) + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi), 0.1f);
|
||||
}
|
||||
else
|
||||
{
|
||||
projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt();
|
||||
projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi);
|
||||
}
|
||||
|
||||
//Increment attack cooldown
|
||||
if (projectile.ai[1] > 0f)
|
||||
{
|
||||
projectile.ai[1] += Main.rand.Next(1, 4);
|
||||
}
|
||||
//Set the minion to be ready for attack
|
||||
if (projectile.ai[1] > 90f)
|
||||
{
|
||||
projectile.ai[1] = 0f;
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
|
||||
//Return if on attack cooldown, has no target, or returning to the player
|
||||
if (projectile.ai[0] != 0f || !foundTarget || projectile.ai[1] != 0f)
|
||||
return;
|
||||
|
||||
if (Main.myPlayer == projectile.owner)
|
||||
{
|
||||
//Play vomit sound
|
||||
if (modPlayer.soundCooldown <= 0)
|
||||
{
|
||||
Main.PlaySound(SoundID.NPCKilled, (int)projectile.Center.X, (int)projectile.Center.Y, 13, 0.5f, 0f);
|
||||
modPlayer.soundCooldown = Main.rand.Next(120, 180);
|
||||
}
|
||||
|
||||
//Increment the attack counter
|
||||
projectile.ai[1]++;
|
||||
|
||||
int projType = ModContent.ProjectileType<GastricBelcherVomit>();
|
||||
|
||||
//Calculate the general velocity
|
||||
Vector2 velocity = targetVec - projectile.Center;
|
||||
velocity.Normalize();
|
||||
|
||||
//Add some inaccuracy for the vomit projectiles
|
||||
float vomitSpeedMult = 16f;
|
||||
Vector2 vomitVel = velocity * vomitSpeedMult;
|
||||
vomitVel.Y += Main.rand.NextFloat(-30f, 30f) * 0.05f;
|
||||
vomitVel.X += Main.rand.NextFloat(-30f, 30f) * 0.05f;
|
||||
|
||||
//Fire the vomit projectile
|
||||
Projectile.NewProjectile(projectile.Center, vomitVel, projType, projectile.damage, projectile.knockBack, projectile.owner, Main.rand.Next(3), 0f);
|
||||
|
||||
//Fire 5 bubbles for every three attacks
|
||||
if (bubbleCounter++ % 3 == 2)
|
||||
{
|
||||
for (int projCount = 0; projCount < 5; projCount++)
|
||||
{
|
||||
//Add a shotgun spread to the bubbles
|
||||
float bubbleSpeedMult = 14f;
|
||||
Vector2 bubbleVel = velocity * bubbleSpeedMult;
|
||||
bubbleVel.Y += Main.rand.NextFloat(-50f, 50f) * 0.05f;
|
||||
bubbleVel.X += Main.rand.NextFloat(-50f, 50f) * 0.05f;
|
||||
|
||||
Projectile.NewProjectile(projectile.Center, bubbleVel, ModContent.ProjectileType<GastricBelcherBubble>(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
|
||||
}
|
||||
}
|
||||
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
//This minion does no contact damage
|
||||
public override bool CanDamage() => false;
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
Texture2D texture = Main.projectileTexture[projectile.type];
|
||||
int frameHeight = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type];
|
||||
int y6 = frameHeight * projectile.frame;
|
||||
SpriteEffects spriteEffects = SpriteEffects.None;
|
||||
if (projectile.spriteDirection == -1)
|
||||
spriteEffects = SpriteEffects.FlipHorizontally;
|
||||
|
||||
spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, frameHeight)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, frameHeight / 2f), projectile.scale, spriteEffects, 0f);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 2.9 KiB |
@@ -0,0 +1,44 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
namespace CalamityMod.Projectiles.Summon
|
||||
{
|
||||
public class GastricBelcherBubble : ModProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Gastric Bubble");
|
||||
ProjectileID.Sets.MinionShot[projectile.type] = true;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.friendly = true;
|
||||
projectile.width = projectile.height = 18;
|
||||
projectile.minion = true;
|
||||
projectile.timeLeft = 180;
|
||||
projectile.aiStyle = 72;
|
||||
}
|
||||
|
||||
public override void Kill(int timeLeft)
|
||||
{
|
||||
Main.PlaySound(SoundID.Item54, projectile.position);
|
||||
Vector2 center = projectile.Center;
|
||||
for (int dustIndex = 0; dustIndex < 10; ++dustIndex)
|
||||
{
|
||||
int scalar = (int)(10 * projectile.ai[1]);
|
||||
int bubble = Dust.NewDust(projectile.Center - Vector2.One * scalar, scalar * 2, scalar * 2, 212, 0.0f, 0.0f, 0, new Color(), 1f);
|
||||
Dust dust = Main.dust[bubble];
|
||||
Vector2 dustVec = Vector2.Normalize(dust.position - projectile.Center);
|
||||
dust.position = projectile.Center + dustVec * scalar * projectile.scale;
|
||||
dust.velocity = dustIndex >= 30 ? dustVec * Main.rand.Next(45, 91) / 10f : dustVec * dust.velocity.Length();
|
||||
dust.color = Main.hslToRgb(0.4f + Main.rand.NextFloat() * 0.2f, 0.9f, 0.5f);
|
||||
dust.color = Color.Lerp(dust.color, Color.White, 0.3f);
|
||||
dust.noGravity = true;
|
||||
dust.scale = 0.7f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 436 B |
@@ -0,0 +1,66 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
namespace CalamityMod.Projectiles.Summon
|
||||
{
|
||||
public class GastricBelcherVomit : ModProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Gastric Vomit");
|
||||
ProjectileID.Sets.MinionShot[projectile.type] = true;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.friendly = true;
|
||||
projectile.width = projectile.height = 18;
|
||||
projectile.minion = true;
|
||||
projectile.timeLeft = 300;
|
||||
projectile.penetrate = 3;
|
||||
projectile.usesIDStaticNPCImmunity = true;
|
||||
projectile.idStaticNPCHitCooldown = 10;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
//Rotation and gravity
|
||||
projectile.rotation += 0.6f * projectile.direction;
|
||||
projectile.velocity.Y += 0.27f;
|
||||
if (projectile.velocity.Y > 16f)
|
||||
{
|
||||
projectile.velocity.Y = 16f;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Kill(int timeLeft)
|
||||
{
|
||||
Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y);
|
||||
//Dust effect
|
||||
int splash = 0;
|
||||
while (splash < 4)
|
||||
{
|
||||
Dust.NewDust(projectile.position, projectile.width, projectile.height, 233, -projectile.velocity.X * 0.15f, -projectile.velocity.Y * 0.10f, 150, default, 0.9f);
|
||||
splash += 1;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
Texture2D texture;
|
||||
switch (projectile.ai[0])
|
||||
{
|
||||
case 1f: texture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/GastricBelcherVomit2");
|
||||
break;
|
||||
case 2f: texture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/GastricBelcherVomit3");
|
||||
break;
|
||||
default: texture = Main.projectileTexture[projectile.type];
|
||||
break;
|
||||
}
|
||||
Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2f), projectile.scale, SpriteEffects.None, 0f);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 437 B |
|
After Width: | Height: | Size: 421 B |
|
After Width: | Height: | Size: 447 B |