Merge branch 'master' of https://github.com/UncleDanny/CalamityMod
This commit is contained in:
commit
ef62ffab3c
15 files changed
+795
-25
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 VileFeederBuff : ModBuff
|
||||
{
|
||||
public override void SetDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Vile Feeder");
|
||||
Description.SetDefault("The baby eater of souls 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<VileFeederSummon>()] > 0)
|
||||
{
|
||||
modPlayer.vileFeeder = true;
|
||||
}
|
||||
if (!modPlayer.vileFeeder)
|
||||
{
|
||||
player.DelBuff(buffIndex);
|
||||
buffIndex--;
|
||||
}
|
||||
else
|
||||
{
|
||||
player.buffTime[buffIndex] = 18000;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 708 B |
@@ -742,6 +742,7 @@ namespace CalamityMod.CalPlayer
|
||||
public bool frostBlossom = false;
|
||||
public bool cinderBlossom = false;
|
||||
public bool belladonaSpirit = false;
|
||||
public bool vileFeeder = false;
|
||||
|
||||
// Biome
|
||||
public bool ZoneCalamity = false;
|
||||
@@ -1256,6 +1257,7 @@ namespace CalamityMod.CalPlayer
|
||||
sDefense = false;
|
||||
sRegen = false;
|
||||
sPower = false;
|
||||
hallowedRune = false;
|
||||
hallowedDefense = false;
|
||||
hallowedRegen = false;
|
||||
hallowedPower = false;
|
||||
@@ -1273,7 +1275,9 @@ namespace CalamityMod.CalPlayer
|
||||
blazingCore = false;
|
||||
voltaicJelly = false;
|
||||
jellyChargedBattery = false;
|
||||
veneratedLocket = false;
|
||||
starbusterCore = false;
|
||||
starTaintedGenerator = false;
|
||||
camper = false;
|
||||
|
||||
daedalusReflect = false;
|
||||
daedalusSplit = false;
|
||||
@@ -1360,7 +1364,7 @@ namespace CalamityMod.CalPlayer
|
||||
sandCloakCooldown = false;
|
||||
spectralVeil = false;
|
||||
plaguedFuelPack = false;
|
||||
camper = false;
|
||||
veneratedLocket = false;
|
||||
|
||||
alcoholPoisoning = false;
|
||||
shadowflame = false;
|
||||
@@ -1554,9 +1558,6 @@ namespace CalamityMod.CalPlayer
|
||||
powerfulRaven = false;
|
||||
dragonFamily = false;
|
||||
providenceStabber = false;
|
||||
hallowedRune = false;
|
||||
starbusterCore = false;
|
||||
starTaintedGenerator = false;
|
||||
plaguebringerMK2 = false;
|
||||
igneousExaltation = false;
|
||||
radiantResolution = false;
|
||||
@@ -1564,6 +1565,7 @@ namespace CalamityMod.CalPlayer
|
||||
frostBlossom = false;
|
||||
cinderBlossom = false;
|
||||
belladonaSpirit = false;
|
||||
vileFeeder = false;
|
||||
|
||||
abyssalDivingSuitPrevious = abyssalDivingSuit;
|
||||
abyssalDivingSuit = abyssalDivingSuitHide = abyssalDivingSuitForce = abyssalDivingSuitPower = false;
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
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 VileFeeder : ModItem
|
||||
{
|
||||
public static int BaseDamage = 15;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Vile Feeder");
|
||||
Tooltip.SetDefault("Summons a baby eater of souls to protect you");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
item.damage = BaseDamage;
|
||||
item.mana = 10;
|
||||
item.width = 66;
|
||||
item.height = 70;
|
||||
item.useTime = item.useAnimation = 35;
|
||||
item.useStyle = 1;
|
||||
item.noMelee = true;
|
||||
item.knockBack = 0.5f;
|
||||
item.value = Item.buyPrice(0, 2, 0, 0);
|
||||
item.rare = 2;
|
||||
item.UseSound = SoundID.Item2;
|
||||
item.autoReuse = true;
|
||||
item.shoot = ModContent.ProjectileType<VileFeederSummon>();
|
||||
item.shootSpeed = 10f;
|
||||
item.summon = 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)
|
||||
{
|
||||
int i = Main.myPlayer;
|
||||
float num72 = item.shootSpeed;
|
||||
float knockback = knockBack;
|
||||
knockback = player.GetWeaponKnockback(item, knockback);
|
||||
player.itemTime = item.useTime;
|
||||
Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true);
|
||||
float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X;
|
||||
float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y;
|
||||
if (player.gravDir == -1f)
|
||||
{
|
||||
num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y;
|
||||
}
|
||||
float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79));
|
||||
if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f))
|
||||
{
|
||||
num78 = (float)player.direction;
|
||||
num79 = 0f;
|
||||
num80 = num72;
|
||||
}
|
||||
else
|
||||
{
|
||||
num80 = num72 / num80;
|
||||
}
|
||||
num78 *= num80;
|
||||
num79 *= num80;
|
||||
vector2.X = (float)Main.mouseX + Main.screenPosition.X;
|
||||
vector2.Y = (float)Main.mouseY + Main.screenPosition.Y;
|
||||
Vector2 spinningpoint = new Vector2(num78, num79);
|
||||
spinningpoint = spinningpoint.RotatedBy(MathHelper.PiOver2, default);
|
||||
Projectile.NewProjectile(vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, type, damage, knockback, i, 0f, 0f);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
ModRecipe recipe = new ModRecipe(mod);
|
||||
recipe.AddIngredient(ItemID.DemoniteBar, 5);
|
||||
recipe.AddIngredient(ItemID.ShadowScale, 9);
|
||||
recipe.AddIngredient(ItemID.Ebonwood, 20);
|
||||
recipe.AddTile(TileID.Anvils);
|
||||
recipe.SetResult(this);
|
||||
recipe.AddRecipe();
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 733 B |
@@ -721,16 +721,22 @@ namespace CalamityMod
|
||||
sAssociation.Call("AddMinionInfo", ItemType<SquirrelSquireStaff>(), BuffType<SquirrelSquireBuff>(), ProjectileType<SquirrelSquireMinion>());
|
||||
sAssociation.Call("AddMinionInfo", ItemType<WulfrumController>(), BuffType<WulfrumDroidBuff>(), ProjectileType<WulfrumDroid>());
|
||||
sAssociation.Call("AddMinionInfo", ItemType<SunSpiritStaff>(), BuffType<SolarSpirit>(), ProjectileType<SolarPixie>());
|
||||
sAssociation.Call("AddMinionInfo", ItemType<FrostBlossomStaff>(), BuffType<FrostBlossomBuff>(), ProjectileType<FrostBlossom>());
|
||||
sAssociation.Call("AddMinionInfo", ItemType<BelladonnaSpiritStaff>(), BuffType<BelladonnaSpiritBuff>(), ProjectileType<BelladonnaSpirit>());
|
||||
sAssociation.Call("AddMinionInfo", ItemType<SeaboundStaff>(), BuffType<BrittleStar>(), ProjectileType<BrittleStarMinion>());
|
||||
sAssociation.Call("AddMinionInfo", ItemType<MagicalConch>(), BuffType<HermitCrab>(), ProjectileType<HermitCrabMinion>());
|
||||
sAssociation.Call("AddMinionInfo", ItemType<VileFeeder>(), BuffType<VileFeederBuff>(), ProjectileType<VileFeederSummon>());
|
||||
sAssociation.Call("AddMinionInfo", ItemType<CinderBlossomStaff>(), BuffType<CinderBlossomBuff>(), ProjectileType<CinderBlossom>());
|
||||
sAssociation.Call("AddMinionInfo", ItemType<BloodClotStaff>(), BuffType<BloodClot>(), ProjectileType<BloodClotMinion>());
|
||||
sAssociation.Call("AddMinionInfo", ItemType<DankStaff>(), BuffType<DankCreeperBuff>(), ProjectileType<DankCreeperMinion>());
|
||||
sAssociation.Call("AddMinionInfo", ItemType<HerringStaff>(), BuffType<Herring>(), ProjectileType<HerringMinion>());
|
||||
sAssociation.Call("AddMinionInfo", ItemType<CorroslimeStaff>(), BuffType<Corroslime>(), ProjectileType<CorroslimeMinion>());
|
||||
sAssociation.Call("AddMinionInfo", ItemType<CrimslimeStaff>(), BuffType<Crimslime>(), ProjectileType<CrimslimeMinion>());
|
||||
sAssociation.Call("AddMinionInfo", ItemType<AncientIceChunk>(), BuffType<IceClasper>(), ProjectileType<IceClasperMinion>());
|
||||
sAssociation.Call("AddMinionInfo", ItemType<BlackHawkRemote>(), BuffType<BlackHawkBuff>(), ProjectileType<BlackHawkSummon>());
|
||||
sAssociation.Call("AddMinionInfo", ItemType<AncientIceChunk>(), BuffType<IceClasper>(), ProjectileType<IceClasperMinion>());
|
||||
sAssociation.Call("AddMinionInfo", ItemType<ShellfishStaff>(), BuffType<ShellfishBuff>(), ProjectileType<Shellfish>());
|
||||
sAssociation.Call("AddMinionInfo", ItemType<HauntedScroll>(), BuffType<HauntedDishesBuff>(), ProjectileType<HauntedDishes>());
|
||||
sAssociation.Call("AddMinionInfo", ItemType<ForgottenApexWand>(), BuffType<ApexSharkBuff>(), ProjectileType<ApexShark>());
|
||||
sAssociation.Call("AddMinionInfo", ItemType<DeepseaStaff>(), BuffType<AquaticStar>(), ProjectileType<AquaticStarMinion>());
|
||||
sAssociation.Call("AddMinionInfo", ItemType<SunGodStaff>(), BuffType<SolarSpiritGod>(), ProjectileType<SolarGod>());
|
||||
sAssociation.Call("AddMinionInfo", ItemType<IgneousExaltation>(), BuffType<IgneousExaltationBuff>(), ProjectileType<IgneousBlade>());
|
||||
|
||||
@@ -411,17 +411,21 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
}
|
||||
}
|
||||
|
||||
public override bool SpecialNPCLoot()
|
||||
{
|
||||
int closestSegmentID = DropHelper.FindClosestWormSegment(npc,
|
||||
ModContent.NPCType<ArmoredDiggerHead>(),
|
||||
ModContent.NPCType<ArmoredDiggerBody>(),
|
||||
ModContent.NPCType<ArmoredDiggerTail>());
|
||||
npc.position = Main.npc[closestSegmentID].position;
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void NPCLoot()
|
||||
{
|
||||
if (Main.rand.NextBool(40))
|
||||
{
|
||||
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType<LeadWizard>());
|
||||
}
|
||||
if (Main.rand.NextBool(3))
|
||||
{
|
||||
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType<DraedonsRemote>());
|
||||
}
|
||||
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType<DemonicBoneAsh>(), Main.rand.Next(2, 5));
|
||||
DropHelper.DropItemChance(npc, ModContent.ItemType<LeadWizard>(), 40);
|
||||
DropHelper.DropItemChance(npc, ModContent.ItemType<DraedonsRemote>(), 3);
|
||||
DropHelper.DropItem(npc, ModContent.ItemType<DemonicBoneAsh>(), Main.rand.Next(2, 5));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Summon
|
||||
projectile.Opacity = 1f - (float)Math.Sin(projectile.ai[1] / 45f) * 0.075f - 0.075f; // Range of 1f to 0.85f
|
||||
if (projectile.localAI[0] == 0f)
|
||||
{
|
||||
projectile.Calamity().spawnedPlayerMinionDamageValue = (player.allDamage + player.minionDamage - 1f);
|
||||
projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage();
|
||||
projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage;
|
||||
for (int i = 0; i < 36; i++)
|
||||
{
|
||||
@@ -74,11 +74,11 @@ namespace CalamityMod.Projectiles.Summon
|
||||
}
|
||||
projectile.localAI[0] += 1f;
|
||||
}
|
||||
if ((player.allDamage + player.minionDamage - 1f) != projectile.Calamity().spawnedPlayerMinionDamageValue)
|
||||
if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue)
|
||||
{
|
||||
int trueDamage = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue /
|
||||
projectile.Calamity().spawnedPlayerMinionDamageValue *
|
||||
(player.allDamage + player.minionDamage - 1f));
|
||||
player.MinionDamage());
|
||||
projectile.damage = trueDamage;
|
||||
}
|
||||
if (projectile.owner == Main.myPlayer)
|
||||
|
||||
@@ -342,7 +342,7 @@ namespace CalamityMod.Projectiles.Summon
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int num645 = 0; num645 < 200; num645++)
|
||||
for (int num645 = 0; num645 < Main.maxNPCs; num645++)
|
||||
{
|
||||
NPC nPC2 = Main.npc[num645];
|
||||
if (nPC2.CanBeChasedBy(projectile, false))
|
||||
|
||||
@@ -87,12 +87,12 @@ namespace CalamityMod.Projectiles.Summon
|
||||
if (projectile.ai[0] == 0f)
|
||||
{
|
||||
//lineColor == 1 means it is spawned from Mollusk Armor rather than the weapon
|
||||
projectile.damage = (int)((modProj.lineColor == 1 ? 1500f : 70f) * (player.allDamage + player.minionDamage - 1f));
|
||||
if ((player.allDamage + player.minionDamage - 1f) != projectile.Calamity().spawnedPlayerMinionDamageValue)
|
||||
projectile.damage = (int)((modProj.lineColor == 1 ? 1500f : 70f) * player.MinionDamage());
|
||||
if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue)
|
||||
{
|
||||
int damage2 = (int)((float)modProj.spawnedPlayerMinionProjectileDamageValue /
|
||||
modProj.spawnedPlayerMinionDamageValue *
|
||||
(player.allDamage + player.minionDamage - 1f));
|
||||
player.MinionDamage());
|
||||
projectile.damage = damage2;
|
||||
}
|
||||
projectile.ai[1] += 1f;
|
||||
@@ -394,7 +394,7 @@ namespace CalamityMod.Projectiles.Summon
|
||||
Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height);
|
||||
if (projectile.owner == Main.myPlayer)
|
||||
{
|
||||
for (int i = 0; i < 200; i++)
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && Main.npc[i].defense < 9999 &&
|
||||
((projectile.friendly && (!Main.npc[i].friendly || projectile.type == 318 || (Main.npc[i].type == 22 && projectile.owner < 255 && Main.player[projectile.owner].killGuide) || (Main.npc[i].type == 54 && projectile.owner < 255 && Main.player[projectile.owner].killClothier))) ||
|
||||
|
||||
@@ -0,0 +1,189 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
namespace CalamityMod.Projectiles.Summon
|
||||
{
|
||||
public class VileFeederProjectile : ModProjectile
|
||||
{
|
||||
private int bounce = 3;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Eater of Souls Mini");
|
||||
Main.projFrames[projectile.type] = 4;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 16;
|
||||
projectile.height = 16;
|
||||
projectile.friendly = true;
|
||||
projectile.alpha = 255;
|
||||
projectile.penetrate = 1;
|
||||
projectile.timeLeft = 300;
|
||||
projectile.minion = true;
|
||||
projectile.extraUpdates = 3;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Player player = Main.player[projectile.owner];
|
||||
if (projectile.alpha > 0)
|
||||
{
|
||||
projectile.alpha -= 50;
|
||||
}
|
||||
else
|
||||
{
|
||||
projectile.extraUpdates = 0;
|
||||
}
|
||||
if (projectile.alpha < 0)
|
||||
{
|
||||
projectile.alpha = 0;
|
||||
}
|
||||
projectile.frameCounter++;
|
||||
if (projectile.frameCounter >= 6)
|
||||
{
|
||||
projectile.frame++;
|
||||
projectile.frameCounter = 0;
|
||||
}
|
||||
if (projectile.frame >= 4)
|
||||
{
|
||||
projectile.frame = 0;
|
||||
}
|
||||
int num3;
|
||||
for (int num369 = 0; num369 < 1; num369 = num3 + 1)
|
||||
{
|
||||
int dustType = 7;
|
||||
float num370 = projectile.velocity.X / 3f * (float)num369;
|
||||
float num371 = projectile.velocity.Y / 3f * (float)num369;
|
||||
int num372 = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 0, default, 1f);
|
||||
Main.dust[num372].position.X = projectile.Center.X - num370;
|
||||
Main.dust[num372].position.Y = projectile.Center.Y - num371;
|
||||
Dust dust = Main.dust[num372];
|
||||
dust.velocity *= 0f;
|
||||
Main.dust[num372].scale = 0.5f;
|
||||
num3 = num369;
|
||||
}
|
||||
projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - MathHelper.PiOver2;
|
||||
float num373 = projectile.position.X;
|
||||
float num374 = projectile.position.Y;
|
||||
float num375 = 100000f;
|
||||
bool flag10 = false;
|
||||
projectile.ai[0] += 1f;
|
||||
if (projectile.ai[0] > 30f)
|
||||
{
|
||||
projectile.ai[0] = 30f;
|
||||
if (player.HasMinionAttackTargetNPC)
|
||||
{
|
||||
NPC npc = Main.npc[player.MinionAttackTargetNPC];
|
||||
if (npc.CanBeChasedBy(projectile, false))
|
||||
{
|
||||
float num377 = npc.position.X + (float)(npc.width / 2);
|
||||
float num378 = npc.position.Y + (float)(npc.height / 2);
|
||||
float num379 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num377) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num378);
|
||||
if (num379 < 800f && num379 < num375 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height))
|
||||
{
|
||||
num375 = num379;
|
||||
num373 = num377;
|
||||
num374 = num378;
|
||||
flag10 = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int num376 = 0; num376 < Main.maxNPCs; num376++)
|
||||
{
|
||||
if (Main.npc[num376].CanBeChasedBy(projectile, false))
|
||||
{
|
||||
float num377 = Main.npc[num376].position.X + (float)(Main.npc[num376].width / 2);
|
||||
float num378 = Main.npc[num376].position.Y + (float)(Main.npc[num376].height / 2);
|
||||
float num379 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num377) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num378);
|
||||
if (num379 < 800f && num379 < num375 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num376].position, Main.npc[num376].width, Main.npc[num376].height))
|
||||
{
|
||||
num375 = num379;
|
||||
num373 = num377;
|
||||
num374 = num378;
|
||||
flag10 = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!flag10)
|
||||
{
|
||||
num373 = projectile.position.X + (float)(projectile.width / 2) + projectile.velocity.X * 100f;
|
||||
num374 = projectile.position.Y + (float)(projectile.height / 2) + projectile.velocity.Y * 100f;
|
||||
}
|
||||
float num380 = 10f;
|
||||
float num381 = 0.16f;
|
||||
Vector2 vector30 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
|
||||
float num382 = num373 - vector30.X;
|
||||
float num383 = num374 - vector30.Y;
|
||||
float num384 = (float)Math.Sqrt((double)(num382 * num382 + num383 * num383));
|
||||
num384 = num380 / num384;
|
||||
num382 *= num384;
|
||||
num383 *= num384;
|
||||
if (projectile.velocity.X < num382)
|
||||
{
|
||||
projectile.velocity.X = projectile.velocity.X + num381;
|
||||
if (projectile.velocity.X < 0f && num382 > 0f)
|
||||
{
|
||||
projectile.velocity.X = projectile.velocity.X + num381 * 2f;
|
||||
}
|
||||
}
|
||||
else if (projectile.velocity.X > num382)
|
||||
{
|
||||
projectile.velocity.X = projectile.velocity.X - num381;
|
||||
if (projectile.velocity.X > 0f && num382 < 0f)
|
||||
{
|
||||
projectile.velocity.X = projectile.velocity.X - num381 * 2f;
|
||||
}
|
||||
}
|
||||
if (projectile.velocity.Y < num383)
|
||||
{
|
||||
projectile.velocity.Y = projectile.velocity.Y + num381;
|
||||
if (projectile.velocity.Y < 0f && num383 > 0f)
|
||||
{
|
||||
projectile.velocity.Y = projectile.velocity.Y + num381 * 2f;
|
||||
}
|
||||
}
|
||||
else if (projectile.velocity.Y > num383)
|
||||
{
|
||||
projectile.velocity.Y = projectile.velocity.Y - num381;
|
||||
if (projectile.velocity.Y > 0f && num383 < 0f)
|
||||
{
|
||||
projectile.velocity.Y = projectile.velocity.Y - num381 * 2f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool OnTileCollide(Vector2 oldVelocity)
|
||||
{
|
||||
bounce--;
|
||||
if (bounce <= 0)
|
||||
{
|
||||
projectile.Kill();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (projectile.velocity.X != oldVelocity.X)
|
||||
{
|
||||
projectile.velocity.X = -oldVelocity.X;
|
||||
}
|
||||
if (projectile.velocity.Y != oldVelocity.Y)
|
||||
{
|
||||
projectile.velocity.Y = -oldVelocity.Y;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool CanDamage()
|
||||
{
|
||||
return projectile.ai[0] >= 30f;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 866 B |
@@ -0,0 +1,444 @@
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.Buffs.Summon;
|
||||
using CalamityMod.Items.Weapons.Summon;
|
||||
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 VileFeederSummon : ModProjectile
|
||||
{
|
||||
private bool spawnDust = true;
|
||||
private float attackCooldown = 0f;
|
||||
private int eaterCooldown = 0;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Eater of Souls");
|
||||
Main.projFrames[projectile.type] = 4;
|
||||
ProjectileID.Sets.MinionSacrificable[projectile.type] = true;
|
||||
ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 30;
|
||||
projectile.height = 30;
|
||||
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()
|
||||
{
|
||||
Player player = Main.player[projectile.owner];
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
|
||||
if (spawnDust)
|
||||
{
|
||||
projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage();
|
||||
projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage;
|
||||
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, 7, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default, 1.1f);
|
||||
Main.dust[num228].noGravity = true;
|
||||
Main.dust[num228].velocity = vector7;
|
||||
}
|
||||
spawnDust = false;
|
||||
}
|
||||
|
||||
bool correctMinion = projectile.type == ModContent.ProjectileType<VileFeederSummon>();
|
||||
player.AddBuff(ModContent.BuffType<VileFeederBuff>(), 3600);
|
||||
if (correctMinion)
|
||||
{
|
||||
if (player.dead)
|
||||
{
|
||||
modPlayer.vileFeeder = false;
|
||||
}
|
||||
if (modPlayer.vileFeeder)
|
||||
{
|
||||
projectile.timeLeft = 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (eaterCooldown < 0)
|
||||
eaterCooldown = 0;
|
||||
|
||||
if (projectile.ai[0] != 3f)
|
||||
{
|
||||
if (eaterCooldown > 0)
|
||||
eaterCooldown--;
|
||||
projectile.damage = (int)(VileFeeder.BaseDamage * player.MinionDamage());
|
||||
if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue)
|
||||
{
|
||||
int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue /
|
||||
projectile.Calamity().spawnedPlayerMinionDamageValue *
|
||||
player.MinionDamage());
|
||||
projectile.damage = damage2;
|
||||
}
|
||||
float antiStickyFloat = 0.05f;
|
||||
for (int index = 0; index < Main.maxProjectiles; index++)
|
||||
{
|
||||
Projectile proj = Main.projectile[index];
|
||||
bool flag23 = proj.type == ModContent.ProjectileType<VileFeederSummon>();
|
||||
if (index != projectile.whoAmI && proj.active && proj.owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - proj.position.X) + Math.Abs(projectile.position.Y - proj.position.Y) < (float)projectile.width)
|
||||
{
|
||||
if (projectile.position.X < proj.position.X)
|
||||
{
|
||||
projectile.velocity.X = projectile.velocity.X - antiStickyFloat;
|
||||
}
|
||||
else
|
||||
{
|
||||
projectile.velocity.X = projectile.velocity.X + antiStickyFloat;
|
||||
}
|
||||
if (projectile.position.Y < proj.position.Y)
|
||||
{
|
||||
projectile.velocity.Y = projectile.velocity.Y - antiStickyFloat;
|
||||
}
|
||||
else
|
||||
{
|
||||
projectile.velocity.Y = projectile.velocity.Y + antiStickyFloat;
|
||||
}
|
||||
}
|
||||
}
|
||||
projectile.frameCounter++;
|
||||
if (projectile.frameCounter > 3)
|
||||
{
|
||||
projectile.frame++;
|
||||
projectile.frameCounter = 0;
|
||||
}
|
||||
if (projectile.frame >= 4)
|
||||
{
|
||||
projectile.frame = 0;
|
||||
}
|
||||
projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(270);
|
||||
|
||||
bool flag24 = false;
|
||||
if (projectile.ai[0] == 2f)
|
||||
{
|
||||
attackCooldown += 1f;
|
||||
projectile.extraUpdates = 1;
|
||||
if (attackCooldown > 40f)
|
||||
{
|
||||
attackCooldown = 1f;
|
||||
projectile.ai[0] = 0f;
|
||||
projectile.extraUpdates = 0;
|
||||
projectile.numUpdates = 0;
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
flag24 = true;
|
||||
}
|
||||
}
|
||||
if (flag24)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Vector2 vector46 = projectile.position;
|
||||
float num633 = 800f; //50 block detection range
|
||||
bool targetFound = false;
|
||||
if (player.HasMinionAttackTargetNPC)
|
||||
{
|
||||
NPC npc = Main.npc[player.MinionAttackTargetNPC];
|
||||
if (npc.CanBeChasedBy(projectile, false))
|
||||
{
|
||||
float npcDist = Vector2.Distance(npc.Center, projectile.Center);
|
||||
if (npcDist < num633 && !targetFound && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height))
|
||||
{
|
||||
num633 = npcDist;
|
||||
vector46 = npc.Center;
|
||||
targetFound = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int num645 = 0; num645 < Main.maxNPCs; num645++)
|
||||
{
|
||||
NPC nPC2 = Main.npc[num645];
|
||||
if (nPC2.CanBeChasedBy(projectile, false))
|
||||
{
|
||||
float npcDist = Vector2.Distance(nPC2.Center, projectile.Center);
|
||||
if (npcDist < num633 && !targetFound && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height))
|
||||
{
|
||||
num633 = npcDist;
|
||||
vector46 = nPC2.Center;
|
||||
targetFound = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
float maxPlayerRange = 1100f;
|
||||
if (targetFound)
|
||||
{
|
||||
maxPlayerRange = 2400f;
|
||||
}
|
||||
if (Vector2.Distance(player.Center, projectile.Center) > maxPlayerRange)
|
||||
{
|
||||
projectile.ai[0] = 1f;
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
if (targetFound && projectile.ai[0] == 0f)
|
||||
{
|
||||
Vector2 vector47 = vector46 - projectile.Center;
|
||||
float num648 = vector47.Length();
|
||||
vector47.Normalize();
|
||||
if (num648 > 200f)
|
||||
{
|
||||
float scaleFactor2 = 8f;
|
||||
vector47 *= scaleFactor2;
|
||||
projectile.velocity = (projectile.velocity * 40f + vector47) / 41f;
|
||||
}
|
||||
else
|
||||
{
|
||||
float num649 = 4f;
|
||||
vector47 *= -num649;
|
||||
projectile.velocity = (projectile.velocity * 40f + vector47) / 41f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bool flag26 = false;
|
||||
if (!flag26)
|
||||
{
|
||||
flag26 = projectile.ai[0] == 1f;
|
||||
}
|
||||
float num650 = 6f;
|
||||
if (flag26)
|
||||
{
|
||||
num650 = 15f;
|
||||
}
|
||||
Vector2 center2 = projectile.Center;
|
||||
Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f);
|
||||
float playerDist = vector48.Length();
|
||||
if (playerDist > 200f && num650 < 8f)
|
||||
{
|
||||
num650 = 8f;
|
||||
}
|
||||
if (playerDist < 150f && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height))
|
||||
{
|
||||
projectile.ai[0] = 0f;
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
if (playerDist > 2000f)
|
||||
{
|
||||
projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2);
|
||||
projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2);
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
if (playerDist > 70f)
|
||||
{
|
||||
vector48.Normalize();
|
||||
vector48 *= num650;
|
||||
projectile.velocity = (projectile.velocity * 40f + vector48) / 41f;
|
||||
}
|
||||
else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f)
|
||||
{
|
||||
projectile.velocity.X = -0.15f;
|
||||
projectile.velocity.Y = -0.05f;
|
||||
}
|
||||
}
|
||||
if (attackCooldown > 0f)
|
||||
{
|
||||
attackCooldown += (float)Main.rand.Next(1, 4);
|
||||
}
|
||||
if (attackCooldown > 40f)
|
||||
{
|
||||
attackCooldown = 0f;
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
if (projectile.ai[0] == 0f)
|
||||
{
|
||||
if (attackCooldown == 0f && targetFound && num633 < 500f)
|
||||
{
|
||||
attackCooldown += 1f;
|
||||
if (Main.myPlayer == projectile.owner)
|
||||
{
|
||||
projectile.ai[0] = 2f;
|
||||
Vector2 value20 = vector46 - projectile.Center;
|
||||
value20.Normalize();
|
||||
projectile.velocity = value20 * 8f;
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
projectile.frame = 0;
|
||||
projectile.extraUpdates = 0;
|
||||
int num988 = 10;
|
||||
bool flag54 = false;
|
||||
bool flag55 = false;
|
||||
projectile.localAI[0] += 1f;
|
||||
if (projectile.localAI[0] % 30f == 0f)
|
||||
{
|
||||
flag55 = true;
|
||||
}
|
||||
int npcIndex = (int)projectile.ai[1];
|
||||
if (projectile.localAI[0] >= (float)(60000 * num988)) //tryna make it stay on there "forever" without glitching
|
||||
{
|
||||
flag54 = true;
|
||||
}
|
||||
else if (npcIndex < 0 || npcIndex >= Main.maxNPCs)
|
||||
{
|
||||
flag54 = true;
|
||||
}
|
||||
else if (Main.npc[npcIndex].active && !Main.npc[npcIndex].dontTakeDamage && Main.npc[npcIndex].defense < 9999)
|
||||
{
|
||||
projectile.Center = Main.npc[npcIndex].Center - projectile.velocity * 2f;
|
||||
projectile.gfxOffY = Main.npc[npcIndex].gfxOffY;
|
||||
if (flag55)
|
||||
{
|
||||
Main.npc[npcIndex].HitEffect(0, 1.0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
flag54 = true;
|
||||
}
|
||||
if (flag54)
|
||||
{
|
||||
projectile.ai[0] = 0f;
|
||||
projectile.velocity.X = 0f;
|
||||
projectile.velocity.Y = 0f;
|
||||
}
|
||||
if (projectile.owner == Main.myPlayer)
|
||||
{
|
||||
if (eaterCooldown > 0)
|
||||
eaterCooldown -= Main.rand.Next(1,4);
|
||||
|
||||
if (eaterCooldown <= 0)
|
||||
{
|
||||
int projNumber = Main.rand.Next(1,4);
|
||||
for (int index2 = 0; index2 < projNumber; index2++)
|
||||
{
|
||||
float xVector = (float)Main.rand.Next(-35, 36) * 0.02f;
|
||||
float yVector = (float)Main.rand.Next(-35, 36) * 0.02f;
|
||||
xVector *= 10f;
|
||||
yVector *= 10f;
|
||||
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, xVector, yVector, ModContent.ProjectileType<VileFeederProjectile>(), (int)(VileFeeder.BaseDamage * player.MinionDamage() * 2f), projectile.knockBack, projectile.owner, 0f, 0f);
|
||||
}
|
||||
eaterCooldown = 60;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
|
||||
{
|
||||
Player player = Main.player[projectile.owner];
|
||||
Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height);
|
||||
if (projectile.owner == Main.myPlayer)
|
||||
{
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
NPC npc = Main.npc[i];
|
||||
if (npc.active && !npc.dontTakeDamage && npc.defense < 9999 &&
|
||||
((projectile.friendly && (!npc.friendly || (npc.type == 22 && projectile.owner < Main.maxPlayers && player.killGuide) || (npc.type == 54 && projectile.owner < Main.maxPlayers && player.killClothier))) && (projectile.owner < 0 || npc.immune[projectile.owner] == 0 || projectile.maxPenetrate == 1)))
|
||||
{
|
||||
if (npc.noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(npc))
|
||||
{
|
||||
bool flag3;
|
||||
if (npc.type == 414)
|
||||
{
|
||||
Rectangle rect = npc.getRect();
|
||||
int num5 = 8;
|
||||
rect.X -= num5;
|
||||
rect.Y -= num5;
|
||||
rect.Width += num5 * 2;
|
||||
rect.Height += num5 * 2;
|
||||
flag3 = projectile.Colliding(myRect, rect);
|
||||
}
|
||||
else
|
||||
{
|
||||
flag3 = projectile.Colliding(myRect, npc.getRect());
|
||||
}
|
||||
if (flag3)
|
||||
{
|
||||
if (npc.reflectingProjectiles && projectile.CanReflect())
|
||||
{
|
||||
npc.ReflectProjectile(projectile.whoAmI);
|
||||
return;
|
||||
}
|
||||
projectile.ai[0] = 3f;
|
||||
projectile.ai[1] = (float)i;
|
||||
projectile.velocity = (npc.Center - projectile.Center) * 0.75f;
|
||||
projectile.netUpdate = true;
|
||||
projectile.StatusNPC(i);
|
||||
projectile.damage = 0;
|
||||
int num28 = 10;
|
||||
Point[] array2 = new Point[num28];
|
||||
int num29 = 0;
|
||||
for (int l = 0; l < Main.maxProjectiles; l++)
|
||||
{
|
||||
Projectile proj = Main.projectile[l];
|
||||
if (l != projectile.whoAmI && proj.active && proj.owner == Main.myPlayer && proj.type == projectile.type && proj.ai[0] == 3f && proj.ai[1] == (float)i)
|
||||
{
|
||||
array2[num29++] = new Point(l, Main.projectile[l].timeLeft);
|
||||
if (num29 >= array2.Length)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (num29 >= array2.Length)
|
||||
{
|
||||
int num30 = 0;
|
||||
for (int m = 1; m < array2.Length; m++)
|
||||
{
|
||||
if (array2[m].Y < array2[num30].Y)
|
||||
{
|
||||
num30 = m;
|
||||
}
|
||||
}
|
||||
Main.projectile[array2[num30].X].Kill();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
|
||||
{
|
||||
if (targetHitbox.Width > 8 && targetHitbox.Height > 8)
|
||||
{
|
||||
targetHitbox.Inflate(-targetHitbox.Width / 8, -targetHitbox.Height / 8);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
SpriteEffects spriteEffects = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
Texture2D texture = Main.projectileTexture[projectile.type];
|
||||
int num214 = texture.Height / Main.projFrames[projectile.type];
|
||||
int y6 = num214 * projectile.frame;
|
||||
Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
target.immune[projectile.owner] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
@@ -415,7 +415,7 @@ namespace CalamityMod
|
||||
Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height);
|
||||
if (projectile.owner == Main.myPlayer)
|
||||
{
|
||||
for (int i = 0; i < 200; i++)
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
if (Main.npc[i].active && !Main.npc[i].dontTakeDamage &&
|
||||
((projectile.friendly && (!Main.npc[i].friendly || projectile.type == 318 || (Main.npc[i].type == 22 && projectile.owner < 255 && Main.player[projectile.owner].killGuide) || (Main.npc[i].type == 54 && projectile.owner < 255 && Main.player[projectile.owner].killClothier))) ||
|
||||
@@ -453,7 +453,7 @@ namespace CalamityMod
|
||||
projectile.damage = 0;
|
||||
Point[] array2 = new Point[maxStick];
|
||||
int num29 = 0;
|
||||
for (int l = 0; l < 1000; l++)
|
||||
for (int l = 0; l < Main.maxProjectiles; l++)
|
||||
{
|
||||
if (l != projectile.whoAmI && Main.projectile[l].active && Main.projectile[l].owner == Main.myPlayer && Main.projectile[l].type == projectile.type && Main.projectile[l].ai[0] == 1f && Main.projectile[l].ai[1] == (float)i)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user