Merge branch 'master' of https://github.com/CalamityTeam/CalamityMod
This commit is contained in:
commit
14fc2d2809
15 files changed
+84
-64
No files matched your search
@@ -67,7 +67,7 @@ namespace CalamityMod.CalPlayer
|
||||
CalamityPlayer.areThereAnyDamnEvents = CalamityGlobalNPC.AnyEvents(player);
|
||||
|
||||
// If any boss NPC is active, apply Zen to the player to reduce spawn rate
|
||||
if (CalamityPlayer.areThereAnyDamnBosses)
|
||||
if (CalamityPlayer.areThereAnyDamnBosses && CalamityConfig.Instance.BossZen)
|
||||
{
|
||||
if (player.whoAmI == Main.myPlayer)
|
||||
player.AddBuff(ModContent.BuffType<BossZen>(), 2, false);
|
||||
|
||||
@@ -100,8 +100,8 @@ namespace CalamityMod.Items
|
||||
#region SetDefaults
|
||||
public override void SetDefaults(Item item)
|
||||
{
|
||||
if (customRarity.IsPostML() && item.rare != ItemRarityID.Red)
|
||||
item.rare = ItemRarityID.Red;
|
||||
if (customRarity.IsPostML() && item.rare != ItemRarityID.Purple)
|
||||
item.rare = ItemRarityID.Purple;
|
||||
|
||||
if (item.maxStack == 99 || item.type == ItemID.Dynamite || item.type == ItemID.StickyDynamite ||
|
||||
item.type == ItemID.BouncyDynamite || item.type == ItemID.StickyBomb || item.type == ItemID.BouncyBomb)
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
item.damage = 63;
|
||||
item.damage = 49;
|
||||
item.ranged = true;
|
||||
item.width = 34;
|
||||
item.height = 100;
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
item.damage = 98;
|
||||
item.damage = 86;
|
||||
item.ranged = true;
|
||||
item.noMelee = true;
|
||||
item.width = 46;
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
{
|
||||
public class CelestialReaper : RogueWeapon
|
||||
{
|
||||
public const int BaseDamage = 147;
|
||||
public const int BaseDamage = 133;
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Celestial Reaper");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using CalamityMod.Projectiles.Summon;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Projectiles.Summon;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
@@ -13,13 +13,13 @@ namespace CalamityMod.Items.Weapons.Summon
|
||||
{
|
||||
DisplayName.SetDefault("Tactical Plague Engine");
|
||||
Tooltip.SetDefault("Summons a plague jet to pummel your enemies into submission\n" +
|
||||
"Consumes bullets\n" +
|
||||
"Jets will fire ammo from your inventory, 66% chance to not consume ammo\n" +
|
||||
"Sometimes shoots a missile instead of a bullet");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
item.damage = 34;
|
||||
item.damage = 52;
|
||||
item.mana = 10;
|
||||
item.width = 28;
|
||||
item.height = 20;
|
||||
@@ -39,9 +39,7 @@ namespace CalamityMod.Items.Weapons.Summon
|
||||
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)
|
||||
{
|
||||
Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -203,10 +203,13 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
|
||||
{
|
||||
Projectile laser = Projectile.NewProjectileDirect(projectile.Center + Utils.Vector2FromElipse(EyeRotation.ToRotationVector2(), projectile.Size * 0.5f * EyeOutwardness),
|
||||
projectile.DirectionTo(npc.Center) * 4f, ProjectileID.UFOLaser, projectile.damage, projectile.knockBack, projectile.owner);
|
||||
laser.timeLeft *= 2;
|
||||
laser.tileCollide = false;
|
||||
laser.netUpdate = true;
|
||||
laser.Calamity().forceMinion = true;
|
||||
if (laser.whoAmI.WithinBounds(Main.maxProjectiles))
|
||||
{
|
||||
laser.timeLeft *= 2;
|
||||
laser.tileCollide = false;
|
||||
laser.netUpdate = true;
|
||||
laser.Calamity().forceMinion = true;
|
||||
}
|
||||
}
|
||||
projectile.ai[1]++;
|
||||
OldCenter = projectile.Center;
|
||||
|
||||
@@ -65,12 +65,12 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
// Adds 2 frames to lifeRegenTime on every hit. This increased value is used for the damage calculation.
|
||||
owner.lifeRegenTime += 2;
|
||||
|
||||
// Deals (1.00 + (0.1 * current lifeRegen))% of current lifeRegenTime as flat bonus damage on hit.
|
||||
// Deals (1.00 + (0.05 * current lifeRegen))% of current lifeRegenTime as flat bonus damage on hit.
|
||||
// For example, at 0 life regen, you get 1% of lifeRegenTime as bonus damage.
|
||||
// At 10 life regen, you get 2%. At 20 life regen, you get 3%.
|
||||
// Negative life regen does not decrease damage.
|
||||
int regenForCalc = owner.lifeRegen > 0 ? owner.lifeRegen : 0;
|
||||
float regenDamageRatio = 0.01f + 0.001f * regenForCalc;
|
||||
float regenDamageRatio = 0.01f + 0.0005f * regenForCalc;
|
||||
|
||||
// For the sake of bonus damage, life regen time caps at 3600, aka 60 seconds. This is its natural cap in vanilla.
|
||||
int regenTimeForCalc = (int)MathHelper.Clamp(owner.lifeRegenTime, 0f, 3600f);
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
float kback = player.ActiveItem().knockBack;
|
||||
if (canShoot)
|
||||
{
|
||||
player.PickAmmo(player.ActiveItem(), ref projType, ref speedMult, ref canShoot, ref damage, ref kback, false);
|
||||
player.PickAmmo(player.ActiveItem(), ref projType, ref speedMult, ref canShoot, ref damage, ref kback);
|
||||
kback = player.GetWeaponKnockback(player.ActiveItem(), kback);
|
||||
float speed = player.ActiveItem().shootSpeed * projectile.scale;
|
||||
Vector2 targetPos = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - source;
|
||||
|
||||
@@ -102,7 +102,8 @@ namespace CalamityMod.Projectiles.Summon
|
||||
if (dealDamage)
|
||||
{
|
||||
Projectile aura = Projectile.NewProjectileDirect(npc.Center, Vector2.Zero, ModContent.ProjectileType<DirectStrike>(), dmg, 0f, projectile.owner, l);
|
||||
aura.Calamity().forceMinion = true;
|
||||
if (aura.whoAmI.WithinBounds(Main.maxProjectiles))
|
||||
aura.Calamity().forceMinion = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,8 +51,8 @@ namespace CalamityMod.Projectiles.Summon
|
||||
float SpeedX = -projectile.velocity.X * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f;
|
||||
float SpeedY = -projectile.velocity.Y * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f;
|
||||
int shard = Projectile.NewProjectile(projectile.Center.X + SpeedX, projectile.Center.Y + SpeedY, SpeedX, SpeedY, ProjectileID.CrystalShard, projectile.damage / 2, 0f, projectile.owner);
|
||||
Main.projectile[shard].Calamity().forceMinion = true;
|
||||
ProjectileID.Sets.MinionShot[Main.projectile[shard].type] = true;
|
||||
if (shard.WithinBounds(Main.maxProjectiles))
|
||||
Main.projectile[shard].Calamity().forceMinion = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Summon
|
||||
velocity.Normalize();
|
||||
velocity *= 8f;
|
||||
int proj = Projectile.NewProjectile(projectile.Center + outerPosVec, velocity, ModContent.ProjectileType<ProfanedCrystalMageFireballSplit>(), damage, projectile.knockBack, projectile.owner, 0f, 0f);
|
||||
if (proj != -1)
|
||||
if (proj.WithinBounds(Main.maxProjectiles))
|
||||
Main.projectile[proj].Calamity().forceMinion = true;
|
||||
if (innerSplits > 0) //only runs if there's still inner splits to create
|
||||
{
|
||||
@@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Summon
|
||||
velocity.Normalize();
|
||||
velocity *= 5f;
|
||||
proj = Projectile.NewProjectile(projectile.Center + innerPosVec, velocity, ModContent.ProjectileType<ProfanedCrystalMageFireballSplit>(), damage, projectile.knockBack, projectile.owner, 0f, 0f);
|
||||
if (proj != -1)
|
||||
if (proj.WithinBounds(Main.maxProjectiles))
|
||||
Main.projectile[proj].Calamity().forceMinion = true;
|
||||
}
|
||||
innerSplits--;
|
||||
@@ -627,7 +627,8 @@ namespace CalamityMod.Projectiles.Summon
|
||||
correctedVelocity.Normalize();
|
||||
correctedVelocity *= 25f;
|
||||
int proj = Projectile.NewProjectile(pos, correctedVelocity, ModContent.ProjectileType<ProfanedCrystalRangedHuges>(), (int)((double)projectile.damage * 1.5f), projectile.knockBack, projectile.owner, 2);
|
||||
Main.projectile[proj].Calamity().forceMinion = true;
|
||||
if (proj.WithinBounds(Main.maxProjectiles))
|
||||
Main.projectile[proj].Calamity().forceMinion = true;
|
||||
((ProfanedCrystalRangedHuges)Main.projectile[proj].modProjectile).boomerSwarm = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,7 +132,8 @@ namespace CalamityMod.Projectiles.Summon
|
||||
velocity.Normalize();
|
||||
velocity *= shootSpeed;
|
||||
int beam = Projectile.NewProjectile(source, velocity, ProjectileID.HeatRay, projectile.damage, projectile.knockBack, projectile.owner);
|
||||
Main.projectile[beam].Calamity().forceMinion = true;
|
||||
if (beam.WithinBounds(Main.maxProjectiles))
|
||||
Main.projectile[beam].Calamity().forceMinion = true;
|
||||
projectile.ai[0] = 50f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -263,12 +263,15 @@ namespace CalamityMod.Projectiles.Summon
|
||||
{
|
||||
Vector2 sparkS = new Vector2(Main.rand.NextFloat(-5f, 5f), Main.rand.NextFloat(-5f, 5f));
|
||||
int spark = Projectile.NewProjectile(projectile.Center, sparkS, ModContent.ProjectileType<Spark>(), projectile.damage, projectile.knockBack, projectile.owner);
|
||||
Main.projectile[spark].Calamity().forceMinion = true;
|
||||
Main.projectile[spark].timeLeft = 120;
|
||||
Main.projectile[spark].penetrate = 3;
|
||||
Main.projectile[spark].usesIDStaticNPCImmunity = true;
|
||||
Main.projectile[spark].idStaticNPCHitCooldown = 10;
|
||||
Main.projectile[spark].usesLocalNPCImmunity = false;
|
||||
if (spark.WithinBounds(Main.maxProjectiles))
|
||||
{
|
||||
Main.projectile[spark].Calamity().forceMinion = true;
|
||||
Main.projectile[spark].timeLeft = 120;
|
||||
Main.projectile[spark].penetrate = 3;
|
||||
Main.projectile[spark].usesIDStaticNPCImmunity = true;
|
||||
Main.projectile[spark].idStaticNPCHitCooldown = 10;
|
||||
Main.projectile[spark].usesLocalNPCImmunity = false;
|
||||
}
|
||||
}
|
||||
sparkCounter = 0;
|
||||
}
|
||||
@@ -507,12 +510,15 @@ namespace CalamityMod.Projectiles.Summon
|
||||
{
|
||||
Vector2 sparkS = new Vector2(Main.rand.NextFloat(-5f, 5f), Main.rand.NextFloat(-5f, 5f));
|
||||
int spark = Projectile.NewProjectile(projectile.Center, sparkS, ModContent.ProjectileType<Spark>(), projectile.damage, projectile.knockBack, projectile.owner);
|
||||
Main.projectile[spark].Calamity().forceMinion = true;
|
||||
Main.projectile[spark].timeLeft = 120;
|
||||
Main.projectile[spark].penetrate = 3;
|
||||
Main.projectile[spark].usesIDStaticNPCImmunity = true;
|
||||
Main.projectile[spark].idStaticNPCHitCooldown = 10;
|
||||
Main.projectile[spark].usesLocalNPCImmunity = false;
|
||||
if (spark.WithinBounds(Main.maxProjectiles))
|
||||
{
|
||||
Main.projectile[spark].Calamity().forceMinion = true;
|
||||
Main.projectile[spark].timeLeft = 120;
|
||||
Main.projectile[spark].penetrate = 3;
|
||||
Main.projectile[spark].usesIDStaticNPCImmunity = true;
|
||||
Main.projectile[spark].idStaticNPCHitCooldown = 10;
|
||||
Main.projectile[spark].usesLocalNPCImmunity = false;
|
||||
}
|
||||
}
|
||||
sparkCounter = 0;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
using CalamityMod.Buffs.Summon;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Items.Weapons.Ranged;
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Projectiles.Ranged;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Projectiles.Ranged;
|
||||
|
||||
namespace CalamityMod.Projectiles.Summon
|
||||
{
|
||||
@@ -38,6 +37,17 @@ namespace CalamityMod.Projectiles.Summon
|
||||
projectile.extraUpdates = 1;
|
||||
}
|
||||
|
||||
// Defines an Item which is a hacked clone of a P90, edited to be summon class instead of ranged.
|
||||
// The false gun's damage is changed to the appropriate value every time a Tactical Plague Jet wants to fire a bullet.
|
||||
private static void DefineFalseGun()
|
||||
{
|
||||
int p90ID = ModContent.ItemType<Items.Weapons.Ranged.P90>();
|
||||
FalseGun = new Item();
|
||||
FalseGun.SetDefaults(p90ID, true);
|
||||
FalseGun.ranged = false;
|
||||
FalseGun.summon = true;
|
||||
}
|
||||
|
||||
public override bool CanDamage() => false;
|
||||
|
||||
public override void AI()
|
||||
@@ -60,9 +70,9 @@ namespace CalamityMod.Projectiles.Summon
|
||||
dust.noGravity = true;
|
||||
}
|
||||
|
||||
// Grab a fake gun, if not defined, with which to fire bullets. This should only need to be defined once.
|
||||
// Construct a fake item to use with vanilla code for the sake of firing bullets.
|
||||
if (FalseGun is null)
|
||||
FalseGun = ItemLoader.GetItem(ModContent.ItemType<P90>()).item;
|
||||
DefineFalseGun();
|
||||
projectile.localAI[0] = 1f;
|
||||
}
|
||||
|
||||
@@ -157,37 +167,37 @@ namespace CalamityMod.Projectiles.Summon
|
||||
|
||||
if (projectile.ai[0]++ % 75f == 24f)
|
||||
{
|
||||
int damage = projectile.damage;
|
||||
int projID = ProjectileID.Bullet;
|
||||
float shootSpeed = FalseGun.shootSpeed;
|
||||
bool canShoot = true;
|
||||
int damage = FalseGun.damage = projectile.damage;
|
||||
float kb = projectile.knockBack;
|
||||
bool shootRocket = ++projectile.ai[1] % 20f == 0f;
|
||||
// Rockets never consume ammo.
|
||||
bool dontConsumeAmmo = Main.rand.NextBool() || shootRocket;
|
||||
int projIndex;
|
||||
|
||||
// One in every 20 shots is a rocket for 1.5x damage. Rockets never consume ammo.
|
||||
if (projectile.ai[1]++ % 20f == 0f)
|
||||
// Vanilla function tricked into using a fake gun item with the appropriate base damage as the "firing item".
|
||||
player.PickAmmo(FalseGun, ref projID, ref shootSpeed, ref canShoot, ref damage, ref kb, dontConsumeAmmo);
|
||||
|
||||
// One in every 20 shots is a rocket which deals 1.5x total damage and extreme knockback.
|
||||
if (shootRocket)
|
||||
{
|
||||
int rocketDamage = (int)(damage * 1.5f);
|
||||
float rocketKB = 5f;
|
||||
int idx = Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(potentialTarget.Center) * 18f, ModContent.ProjectileType<MK2RocketHoming>(),
|
||||
float rocketKB = kb + 5f;
|
||||
projIndex = Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(potentialTarget.Center) * 18f, ModContent.ProjectileType<MK2RocketHoming>(),
|
||||
rocketDamage, rocketKB, projectile.owner);
|
||||
Main.projectile[idx].Calamity().forceMinion = true;
|
||||
}
|
||||
|
||||
// All other shots are bullets, fired from a "fake gun". The bullets are consumed from the player's inventory as per normal.
|
||||
else
|
||||
{
|
||||
int projID = 0;
|
||||
float shootSpeed = 0f;
|
||||
bool canShoot = true;
|
||||
float kb = projectile.knockBack;
|
||||
player.PickAmmo(FalseGun, ref projID, ref shootSpeed, ref canShoot, ref damage, ref kb);
|
||||
|
||||
// Tactical Plague Jets only deal 60% damage with Holy Fire Bullets. There was no other way to nerf them.
|
||||
if (projID == ModContent.ProjectileType<HolyFireBulletProj>())
|
||||
damage = (int)(damage * 0.6f);
|
||||
|
||||
int bullet = Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(potentialTarget.Center) * shootSpeed, projID,
|
||||
// Fire the selected bullet, nothing special.
|
||||
projIndex = Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(potentialTarget.Center) * shootSpeed, projID,
|
||||
damage, kb, projectile.owner);
|
||||
|
||||
if (bullet.WithinBounds(Main.maxProjectiles))
|
||||
Main.projectile[bullet].Calamity().forceMinion = true;
|
||||
}
|
||||
|
||||
// Regardless of what was fired, force it to be a summon projectile so that summon accessories work.
|
||||
if (projIndex.WithinBounds(Main.maxProjectiles))
|
||||
Main.projectile[projIndex].Calamity().forceMinion = true;
|
||||
}
|
||||
|
||||
// Prevent minion clumping while firing.
|
||||
|
||||
Reference in new issue
Block a user