Merge branch 'master' of https://github.com/UncleDanny/CalamityMod
No files matched your search
@@ -0,0 +1,49 @@
|
||||
using CalamityMod.Projectiles.Summon;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Summon
|
||||
{
|
||||
public class LanternoftheSoul : ModItem
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Lantern of the Soul");
|
||||
Tooltip.SetDefault("Summons a lantern turret to fight for you");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
item.damage = 180;
|
||||
item.summon = true;
|
||||
item.sentry = true;
|
||||
item.mana = 10;
|
||||
item.width = 42;
|
||||
item.height = 60;
|
||||
item.useTime = 36;
|
||||
item.useAnimation = 36;
|
||||
item.useStyle = 1;
|
||||
item.noMelee = true;
|
||||
item.knockBack = 5f;
|
||||
item.value = Item.buyPrice(1, 40, 0, 0);
|
||||
item.rare = 10;
|
||||
item.autoReuse = true;
|
||||
item.shoot = ModContent.ProjectileType<LanternSoul>();
|
||||
item.Calamity().postMoonLordRarity = 22;
|
||||
item.UseSound = SoundID.Item44;
|
||||
}
|
||||
|
||||
public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
|
||||
{
|
||||
position = Main.MouseWorld;
|
||||
speedX = 0;
|
||||
speedY = 0;
|
||||
Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI);
|
||||
player.UpdateMaxTurrets();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 686 B After Width: | Height: | Size: 997 B |
|
Before Width: | Height: | Size: 686 B After Width: | Height: | Size: 997 B |
@@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
float num473 = projectile.Center.Y;
|
||||
float num474 = 600f;
|
||||
bool flag17 = false;
|
||||
for (int num475 = 0; num475 < 200; num475++)
|
||||
for (int num475 = 0; num475 < Main.npc.Length; num475++)
|
||||
{
|
||||
if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1))
|
||||
{
|
||||
|
||||
@@ -85,10 +85,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
}
|
||||
int num988 = 15;
|
||||
bool flag55 = false;
|
||||
float[] var_2_2CB4E_cp_0 = projectile.localAI;
|
||||
int var_2_2CB4E_cp_1 = 0;
|
||||
float num73 = var_2_2CB4E_cp_0[var_2_2CB4E_cp_1];
|
||||
var_2_2CB4E_cp_0[var_2_2CB4E_cp_1] = num73 + 1f;
|
||||
projectile.localAI[0] += 1f;
|
||||
if (projectile.localAI[0] % 30f == 0f)
|
||||
{
|
||||
flag55 = true;
|
||||
@@ -115,7 +112,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
float pcy = projectile.Center.Y;
|
||||
float var1 = 800f;
|
||||
bool flag = false;
|
||||
for (int npcvar = 0; npcvar < 200; npcvar++)
|
||||
for (int npcvar = 0; npcvar < Main.npc.Length; npcvar++)
|
||||
{
|
||||
if (Main.npc[npcvar].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[npcvar].Center, 1, 1))
|
||||
{
|
||||
@@ -160,7 +157,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
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.npc.Length; 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))) ||
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
{
|
||||
if (projectile.owner == Main.myPlayer)
|
||||
{
|
||||
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0f, 2f, ModContent.ProjectileType<SupernovaHoming>(), (int)((double)projectile.damage * 0.6), projectile.knockBack, projectile.owner, 0f, 0f);
|
||||
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0f, 2f, ModContent.ProjectileType<SupernovaHoming>(), (int)((double)projectile.damage * 0.8), projectile.knockBack, projectile.owner, 0f, 0f);
|
||||
}
|
||||
stealthTimer = 8;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Summon
|
||||
if (Main.rand.NextBool(15))
|
||||
{
|
||||
int num = 0;
|
||||
for (int i = 0; i < 1000; i++)
|
||||
for (int i = 0; i < Main.projectile.Length; i++)
|
||||
{
|
||||
if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == ModContent.ProjectileType<Dreadmine>())
|
||||
{
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
namespace CalamityMod.Projectiles.Summon
|
||||
{
|
||||
public class LanternFlame : ModProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Flame");
|
||||
Main.projFrames[projectile.type] = 4;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 20;
|
||||
projectile.height = 20;
|
||||
projectile.friendly = true;
|
||||
projectile.minion = true;
|
||||
projectile.penetrate = 1;
|
||||
projectile.timeLeft = 600;
|
||||
projectile.alpha = 255;
|
||||
projectile.tileCollide = false;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.65f / 255f);
|
||||
projectile.frameCounter++;
|
||||
if (projectile.frameCounter > 4)
|
||||
{
|
||||
projectile.frame++;
|
||||
projectile.frameCounter = 0;
|
||||
}
|
||||
if (projectile.frame > 3)
|
||||
{
|
||||
projectile.frame = 0;
|
||||
}
|
||||
|
||||
if (projectile.alpha > 0)
|
||||
{
|
||||
projectile.alpha -= 10;
|
||||
}
|
||||
if (projectile.alpha <= 25)
|
||||
{
|
||||
float num472 = projectile.Center.X;
|
||||
float num473 = projectile.Center.Y;
|
||||
float num474 = 700f;
|
||||
bool flag17 = false;
|
||||
if (Main.player[projectile.owner].HasMinionAttackTargetNPC)
|
||||
{
|
||||
NPC npc = Main.npc[Main.player[projectile.owner].MinionAttackTargetNPC];
|
||||
if (npc.CanBeChasedBy(projectile, false))
|
||||
{
|
||||
float num950 = npc.position.X + (float)(npc.width / 2);
|
||||
float num951 = npc.position.Y + (float)(npc.height / 2);
|
||||
float num952 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num950) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num951);
|
||||
if (num952 < num474)
|
||||
{
|
||||
num474 = num952;
|
||||
num472 = num950;
|
||||
num473 = num951;
|
||||
flag17 = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int num475 = 0; num475 < Main.npc.Length; num475++)
|
||||
{
|
||||
if (Main.npc[num475].CanBeChasedBy(projectile, false))
|
||||
{
|
||||
float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2);
|
||||
float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2);
|
||||
float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477);
|
||||
if (num478 < num474)
|
||||
{
|
||||
num474 = num478;
|
||||
num472 = num476;
|
||||
num473 = num477;
|
||||
flag17 = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (flag17)
|
||||
{
|
||||
float num483 = 16f;
|
||||
Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
|
||||
float num484 = num472 - vector35.X;
|
||||
float num485 = num473 - vector35.Y;
|
||||
float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485));
|
||||
num486 = num483 / num486;
|
||||
num484 *= num486;
|
||||
num485 *= num486;
|
||||
projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f;
|
||||
projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Kill(int timeLeft)
|
||||
{
|
||||
projectile.position = projectile.Center;
|
||||
projectile.width = projectile.height = 48;
|
||||
projectile.position.X = projectile.position.X - (float)(projectile.width / 2);
|
||||
projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2);
|
||||
projectile.maxPenetrate = -1;
|
||||
projectile.penetrate = -1;
|
||||
projectile.usesLocalNPCImmunity = true;
|
||||
projectile.localNPCHitCooldown = 10;
|
||||
projectile.Damage();
|
||||
Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 74);
|
||||
for (int num621 = 0; num621 < 10; num621++)
|
||||
{
|
||||
int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f);
|
||||
Main.dust[num622].velocity *= 3f;
|
||||
if (Main.rand.NextBool(2))
|
||||
{
|
||||
Main.dust[num622].scale = 0.5f;
|
||||
Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
|
||||
}
|
||||
}
|
||||
for (int num623 = 0; num623 < 15; num623++)
|
||||
{
|
||||
int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 3f);
|
||||
Main.dust[num624].noGravity = true;
|
||||
Main.dust[num624].velocity *= 5f;
|
||||
num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f);
|
||||
Main.dust[num624].velocity *= 2f;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
target.AddBuff(BuffID.ShadowFlame, 180);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 997 B |
@@ -0,0 +1,85 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
namespace CalamityMod.Projectiles.Summon
|
||||
{
|
||||
public class LanternSoul : ModProjectile
|
||||
{
|
||||
public float count = 0;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Lantern");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 26;
|
||||
projectile.height = 26;
|
||||
projectile.ignoreWater = true;
|
||||
projectile.tileCollide = false;
|
||||
projectile.sentry = true;
|
||||
projectile.timeLeft = Projectile.SentryLifeTime;
|
||||
projectile.penetrate = -1;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.65f / 255f);
|
||||
Player player = Main.player[projectile.owner];
|
||||
if (projectile.localAI[0] == 0f)
|
||||
{
|
||||
projectile.Calamity().spawnedPlayerMinionDamageValue = (player.allDamage + player.minionDamage - 1f);
|
||||
projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage;
|
||||
projectile.localAI[0] += 1f;
|
||||
}
|
||||
if ((player.allDamage + player.minionDamage - 1f) != projectile.Calamity().spawnedPlayerMinionDamageValue)
|
||||
{
|
||||
int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue /
|
||||
projectile.Calamity().spawnedPlayerMinionDamageValue *
|
||||
(player.allDamage + player.minionDamage - 1f));
|
||||
projectile.damage = damage2;
|
||||
}
|
||||
|
||||
projectile.velocity = new Vector2(0f, (float)Math.Sin((double)(6.28318548f * projectile.ai[0] / 300f)) * 0.5f);
|
||||
projectile.ai[0] += 1f;
|
||||
if (projectile.ai[0] >= 300f)
|
||||
{
|
||||
projectile.ai[0] = 0f;
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
|
||||
int num = 0;
|
||||
for (int i = 0; i < Main.projectile.Length; i++)
|
||||
{
|
||||
if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == ModContent.ProjectileType<LanternFlame>())
|
||||
{
|
||||
num++;
|
||||
}
|
||||
}
|
||||
if (num < 20)
|
||||
{
|
||||
projectile.ai[1] += (float)Main.rand.Next(2,6) + 1f;
|
||||
if (projectile.ai[1] >= 75f)
|
||||
{
|
||||
projectile.ai[1] = 0f;
|
||||
projectile.netUpdate = true;
|
||||
if (projectile.owner == Main.myPlayer)
|
||||
{
|
||||
float startOffsetX = Main.rand.NextFloat(15f, 200f) * (Main.rand.NextBool() ? -1f : 1f);
|
||||
float startOffsetY = Main.rand.NextFloat(15f, 200f) * (Main.rand.NextBool() ? -1f : 1f);
|
||||
Vector2 startPos = new Vector2(projectile.position.X + startOffsetX, projectile.position.Y + startOffsetY);
|
||||
Vector2 speed = new Vector2(0f, 0f);
|
||||
Projectile.NewProjectile(startPos, speed, ModContent.ProjectileType<LanternFlame>(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool CanDamage()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 558 B |