Redid DR formula so that DR applies after vanilla defense.

Also moved AEW & Sepulcher DR to vanilla damage taken multiplier, and moved flat defense reductions for Calamity debuffs into their buff files.
Unified line endings and added extensions to get CalamityGlobalNPC and CalamityGlobalProjectile.

THIS WILL REQUIRE ENORMOUS AMOUNTS OF TESTING AND REBALANCING.
This commit is contained in:
Ozzatron committed 2019-10-07 19:40:40 -04:00
1 parent b7e2c847cb
commit ae1fa7bec5
42 files changed
+189 -188

No files matched your search

+3 -2
View File
@@ -1,13 +1,14 @@
using Terraria;
using Terraria.ModLoader;
using CalamityMod.NPCs;
using CalamityMod.CalPlayer;
namespace CalamityMod.Buffs.DoTDebuffs
{
public class AbyssalFlames : ModBuff
{
public override void SetDefaults()
public static int DefenseReduction = 10;
public override void SetDefaults()
{
DisplayName.SetDefault("Abyssal Flames");
Description.SetDefault("Your soul is being consumed");
+3 -2
View File
@@ -1,13 +1,14 @@
using Terraria;
using Terraria.ModLoader;
using CalamityMod.NPCs;
using CalamityMod.CalPlayer;
namespace CalamityMod.Buffs.DoTDebuffs
{
public class AstralInfectionDebuff : ModBuff
{
public override void SetDefaults()
public static int DefenseReduction = 8;
public override void SetDefaults()
{
DisplayName.SetDefault("Astral Infection");
Description.SetDefault("Your flesh is melting off");
+3 -2
View File
@@ -1,13 +1,14 @@
using Terraria;
using Terraria.ModLoader;
using CalamityMod.NPCs;
using CalamityMod.CalPlayer;
namespace CalamityMod.Buffs.DoTDebuffs
{
public class GodSlayerInferno : ModBuff
{
public override void SetDefaults()
public static int DefenseReduction = 20;
public override void SetDefaults()
{
DisplayName.SetDefault("God Slayer Inferno");
Description.SetDefault("Your flesh is burning off");
+3 -2
View File
@@ -1,13 +1,14 @@
using Terraria;
using Terraria.ModLoader;
using CalamityMod.NPCs;
using CalamityMod.CalPlayer;
namespace CalamityMod.Buffs.DoTDebuffs
{
public class Plague : ModBuff
{
public override void SetDefaults()
public static int DefenseReduction = 4;
public override void SetDefaults()
{
DisplayName.SetDefault("Plague");
Description.SetDefault("Rotting from the inside");
+3 -1
View File
@@ -6,7 +6,9 @@ namespace CalamityMod.Buffs.StatDebuffs
{
public class WarCleave : ModBuff
{
public override void SetDefaults()
public static int DefenseReduction = 15;
public override void SetDefaults()
{
DisplayName.SetDefault("War Cleave");
Description.SetDefault("Defense and protection reduced");
+3 -2
View File
@@ -1,13 +1,14 @@
using Terraria;
using Terraria.ModLoader;
using CalamityMod.NPCs;
using CalamityMod.CalPlayer;
namespace CalamityMod.Buffs.StatDebuffs
{
public class WhisperingDeath : ModBuff
{
public override void SetDefaults()
public static int DefenseReduction = 50;
public override void SetDefaults()
{
DisplayName.SetDefault("Whispering Death");
Description.SetDefault("Death approaches; defense, attack power, and life regen reduced");
+2 -2
View File
@@ -16,8 +16,8 @@ namespace CalamityMod.Items.Accessories
"20% increased stealth regeneration while moving\n" +
"Stealth regeneration rate exponentially increases while standing still\n" +
"Stealth strikes have a 100% critical hit chance\n" +
"Stealth strikes only expend 50% of your max stealth\n" +
"Grants a small chance to evade attacks in a blast of darksun light, which inflicts extreme damage in a wide area\n" +
"Stealth strikes only expend 50% of your max stealth\n" +
"Grants a small chance to evade attacks in a blast of darksun light, which inflicts extreme damage in a wide area\n" +
"Evading an attack grants full stealth\n" +
"This evade has a 20s cooldown before it can occur again");
}
+1 -1
View File
@@ -10,7 +10,7 @@ namespace CalamityMod.Items.Accessories
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Ruin Medallion");
Tooltip.SetDefault("Stealth strikes only expend 50% of your max stealth\n" +
Tooltip.SetDefault("Stealth strikes only expend 50% of your max stealth\n" +
"6% increased rogue damage, and 6% increased rogue crit chance");
}
@@ -44,4 +44,4 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage
return false;
}
}
}
}
@@ -53,7 +53,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage
}
return false;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
+1 -1
View File
@@ -1803,7 +1803,7 @@ namespace CalamityMod.Items
if (item.type == ItemID.WormScarf)
player.endurance -= 0.07f;
if (item.type == ItemID.RoyalGel)
modPlayer.royalGel = true;
+1 -1
View File
@@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Astral
item.shoot = mod.ProjectileType("AstralRound");
item.useAmmo = 97;
}
public override Vector2? HoldoutOffset()
{
return new Vector2(-5, 0);
+1 -1
View File
@@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Bumblebirb
item.useAmmo = 97;
item.GetGlobalItem<CalamityGlobalItem>(mod).postMoonLordRarity = 12;
}
public override Vector2? HoldoutOffset()
{
return new Vector2(-5, 0);
+1 -1
View File
@@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Crabulon
item.shootSpeed = 14f;
item.useAmmo = 97;
}
public override Vector2? HoldoutOffset()
{
return new Vector2(-5, 0);
+4 -4
View File
@@ -40,19 +40,19 @@ namespace CalamityMod.Items.Weapons
item.shootSpeed = 14.6f;
item.useAmmo = 23;
}
public override Vector2? HoldoutOffset()
{
return new Vector2(-15, 0);
}
public override bool ConsumeAmmo(Player player)
{
if (Main.rand.Next(0, 100) < 50)
return false;
return true;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
@@ -63,4 +63,4 @@ namespace CalamityMod.Items.Weapons
recipe.AddRecipe();
}
}
}
}
+1 -1
View File
@@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Perforators
item.shootSpeed = 22f;
item.useAmmo = 97;
}
public override Vector2? HoldoutOffset()
{
return new Vector2(-7, 0);
+2 -2
View File
@@ -39,12 +39,12 @@ namespace CalamityMod.Items.Weapons
item.useAmmo = 97;
item.GetGlobalItem<CalamityGlobalItem>(mod).postMoonLordRarity = 14;
}
public override Vector2? HoldoutOffset()
{
return new Vector2(-10, 0);
}
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)
{
float SpeedX = speedX + (float)Main.rand.Next(-5, 6) * 0.05f;
+1 -1
View File
@@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons
item.shoot = mod.ProjectileType("SlagRound");
item.useAmmo = 97;
}
public override Vector2? HoldoutOffset()
{
return new Vector2(-10, 0);
+1 -1
View File
@@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.SlimeGod
item.shootSpeed = 5f;
item.useAmmo = 97;
}
public override Vector2? HoldoutOffset()
{
return new Vector2(-5, 0);
+1 -1
View File
@@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.SlimeGod
item.shoot = mod.ProjectileType("SlimeBolt");
item.useAmmo = 23;
}
public override Vector2? HoldoutOffset()
{
return new Vector2(-4, 0);
+4 -4
View File
@@ -36,19 +36,19 @@ namespace CalamityMod.Items.Weapons
item.shootSpeed = 5f;
item.useAmmo = 23;
}
public override Vector2? HoldoutOffset()
{
return new Vector2(-4, 0);
}
public override bool ConsumeAmmo(Player player)
{
if (Main.rand.Next(0, 100) < 20)
return false;
return true;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
@@ -60,4 +60,4 @@ namespace CalamityMod.Items.Weapons
recipe.AddRecipe();
}
}
}
}
+2 -1
View File
@@ -31,7 +31,8 @@ namespace CalamityMod.NPCs.AbyssNPCs
npc.width = 254; //36
npc.height = 138; //20
npc.defense = 3000;
npc.lifeMax = 1000000;
npc.takenDamageMultiplier = 1E-6f;
npc.lifeMax = 1000000;
npc.aiStyle = -1;
aiType = -1;
for (int k = 0; k < npc.buffImmune.Length; k++)
+5 -5
View File
@@ -32,7 +32,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs
//banner = npc.type;
//bannerItem = mod.ItemType("TwinklerBanner");
}
public override bool? CanBeHitByItem(Player player, Item item) {
return true;
@@ -68,10 +68,10 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs
public virtual void OnCatchNPC(Player player, Item item)
{
try
try
{
var npcCenter = npc.Center.ToTileCoordinates();
if (!WorldGen.SolidTile(npcCenter.X, npcCenter.Y) && Main.tile[npcCenter.X, npcCenter.Y].liquid == 0)
if (!WorldGen.SolidTile(npcCenter.X, npcCenter.Y) && Main.tile[npcCenter.X, npcCenter.Y].liquid == 0)
{
Main.tile[npcCenter.X, npcCenter.Y].liquid = (byte)Main.rand.Next(50, 150);
Main.tile[npcCenter.X, npcCenter.Y].lava(true);
@@ -79,13 +79,13 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs
WorldGen.SquareTileFrame(npcCenter.X, npcCenter.Y, true);
}
}
catch
catch
{
return;
}
}
}
internal class TwinklerItem : ModItem
{
public override void SetStaticDefaults()
+97 -117
View File
@@ -1,3 +1,5 @@
using CalamityMod.Buffs.DoTDebuffs;
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.CalPlayer;
using CalamityMod.Projectiles;
using CalamityMod.Utilities;
@@ -17,9 +19,7 @@ namespace CalamityMod.NPCs
public class CalamityGlobalNPC : GlobalNPC
{
#region Variables
// Damage reduction
private float protection = 0f;
private float defProtection = 0f;
private float DR = 0f;
// Iron Heart
private int ironHeartDamage = 0;
@@ -564,11 +564,6 @@ namespace CalamityMod.NPCs
{
IronHeartChanges(npc);
}
if (protection > 0f)
{
defProtection = protection;
}
}
#endregion
@@ -834,30 +829,30 @@ namespace CalamityMod.NPCs
if (npc.type == thorium.NPCType("Viscount") || npc.type == thorium.NPCType("BoreanStrider") || npc.type == thorium.NPCType("FallenDeathBeholder") ||
npc.type == thorium.NPCType("Lich") || npc.type == thorium.NPCType("AbyssionReleased"))
{
protection = 0.05f;
DR = 0.05f;
}
else if (npc.type == thorium.NPCType("CryoCore") || npc.type == thorium.NPCType("BioCore") || npc.type == thorium.NPCType("PyroCore") ||
npc.type == thorium.NPCType("Aquaius"))
{
protection = 0.1f;
DR = 0.1f;
}
else if (npc.type == thorium.NPCType("ThePrimeScouter") || npc.type == thorium.NPCType("FallenDeathBeholder2") || npc.type == thorium.NPCType("SlagFury") ||
npc.type == thorium.NPCType("Aquaius2") || npc.type == thorium.NPCType("GraniteEnergyStorm"))
{
protection = 0.2f;
DR = 0.2f;
}
else if (npc.type == thorium.NPCType("TheBuriedWarrior") || npc.type == thorium.NPCType("TheBuriedWarrior1") || npc.type == thorium.NPCType("TheBuriedWarrior2") ||
npc.type == thorium.NPCType("LichHeadless") || npc.type == thorium.NPCType("AbyssionCracked"))
{
protection = 0.25f;
DR = 0.25f;
}
else if (npc.type == thorium.NPCType("Omnicide"))
{
protection = 0.3f;
DR = 0.3f;
}
else if (npc.type == thorium.NPCType("Abyssion"))
{
protection = 0.35f;
DR = 0.35f;
}
}
}
@@ -867,7 +862,7 @@ namespace CalamityMod.NPCs
npc.type == mod.NPCType("ScornEater") || npc.type == mod.NPCType("AquaticScourgeBody") || npc.type == mod.NPCType("AquaticScourgeBodyAlt") ||
npc.type == mod.NPCType("Mauler") || npc.type == mod.NPCType("EutrophicRay"))
{
protection = 0.05f;
DR = 0.05f;
}
else if (npc.type == mod.NPCType("AstrumDeusBody") || npc.type == mod.NPCType("SoulSeeker") || npc.type == mod.NPCType("DesertScourgeTail") ||
npc.type == mod.NPCType("Horse") || npc.type == mod.NPCType("ProfanedEnergyBody") || npc.type == mod.NPCType("ScavengerClawLeft") ||
@@ -875,7 +870,7 @@ namespace CalamityMod.NPCs
npc.type == mod.NPCType("PhantomDebris") || npc.type == mod.NPCType("AstrumDeusHead") || npc.type == mod.NPCType("AquaticScourgeHead") ||
npc.type == mod.NPCType("Cryon") || npc.type == mod.NPCType("Cryogen"))
{
protection = 0.1f;
DR = 0.1f;
}
else if (npc.type == mod.NPCType("ArmoredDiggerHead") || npc.type == mod.NPCType("AstralProbe") || npc.type == mod.NPCType("Calamitas") ||
npc.type == mod.NPCType("CalamitasRun") || npc.type == mod.NPCType("CalamitasRun2") || npc.type == mod.NPCType("CalamitasRun3") ||
@@ -888,39 +883,39 @@ namespace CalamityMod.NPCs
npc.type == mod.NPCType("Hive") || npc.type == mod.NPCType("Mantis") || npc.type == mod.NPCType("Nova") || npc.type == mod.NPCType("SmallSightseer") ||
npc.type == mod.NPCType("StellarCulex"))
{
protection = 0.15f;
DR = 0.15f;
}
else if (npc.type == mod.NPCType("AstrumDeusProbe3") || npc.type == mod.NPCType("PlaguebringerShade") || npc.type == mod.NPCType("BlindedAngler"))
{
protection = 0.2f;
DR = 0.2f;
}
else if (npc.type == mod.NPCType("PlaguebringerGoliath") || npc.type == mod.NPCType("ProfanedGuardianBoss2") || npc.type == mod.NPCType("SandTortoise") ||
npc.type == mod.NPCType("StasisProbe") || npc.type == mod.NPCType("BobbitWormHead") || npc.type == mod.NPCType("GreatSandShark") ||
npc.type == mod.NPCType("Clam") || npc.type == mod.NPCType("PrismTurtle"))
{
protection = 0.25f;
DR = 0.25f;
}
else if (npc.type == mod.NPCType("ProvSpawnOffense") || npc.type == mod.NPCType("GiantClam"))
{
protection = 0.3f;
DR = 0.3f;
}
else if (npc.type == mod.NPCType("ArmoredDiggerBody") || npc.type == mod.NPCType("AstrumDeusTail") || npc.type == mod.NPCType("DespairStone") ||
npc.type == mod.NPCType("SoulSeekerSupreme") || npc.type == mod.NPCType("Leviathan"))
{
protection = 0.35f;
DR = 0.35f;
}
else if (npc.type == mod.NPCType("CryogenIce") || npc.type == mod.NPCType("ProfanedGuardianBoss") || npc.type == mod.NPCType("ProvSpawnDefense") ||
npc.type == mod.NPCType("ScavengerBody"))
{
protection = 0.4f;
DR = 0.4f;
}
else if (npc.type == mod.NPCType("ArmoredDiggerTail"))
{
protection = 0.45f;
DR = 0.45f;
}
else if (npc.type == mod.NPCType("SirenIce"))
{
protection = 0.5f;
DR = 0.5f;
}
else
{
@@ -939,7 +934,7 @@ namespace CalamityMod.NPCs
case NPCID.CultistBoss:
case NPCID.Crab:
case NPCID.SeaSnail:
protection = 0.05f;
DR = 0.05f;
break;
case NPCID.Antlion:
@@ -961,7 +956,7 @@ namespace CalamityMod.NPCs
case NPCID.ArmoredViking:
case NPCID.DD2Betsy:
case NPCID.DD2OgreT2:
protection = 0.1f;
DR = 0.1f;
break;
case NPCID.ElfCopter:
@@ -969,7 +964,7 @@ namespace CalamityMod.NPCs
case NPCID.ArmoredSkeleton:
case NPCID.PirateShipCannon:
case NPCID.DD2OgreT3:
protection = 0.15f;
DR = 0.15f;
break;
case NPCID.Retinazer:
@@ -1015,7 +1010,7 @@ namespace CalamityMod.NPCs
case NPCID.GiantShelly:
case NPCID.GiantShelly2:
case NPCID.Mothron:
protection = 0.2f;
DR = 0.2f;
break;
case NPCID.PrimeSaw:
@@ -1028,7 +1023,7 @@ namespace CalamityMod.NPCs
case NPCID.GolemFistRight:
case NPCID.GolemHead:
case NPCID.GolemHeadFree:
protection = 0.25f;
DR = 0.25f;
break;
case NPCID.Mimic:
@@ -1037,7 +1032,7 @@ namespace CalamityMod.NPCs
case NPCID.BigMimicCrimson:
case NPCID.BigMimicHallow:
case NPCID.BigMimicJungle:
protection = 0.3f;
DR = 0.3f;
break;
case NPCID.GiantTortoise:
@@ -1045,24 +1040,24 @@ namespace CalamityMod.NPCs
case NPCID.SantaNK1:
case NPCID.MartianWalker:
case NPCID.TheDestroyerTail:
protection = 0.35f;
DR = 0.35f;
break;
case NPCID.DeadlySphere:
protection = 0.4f;
DR = 0.4f;
break;
case NPCID.Paladin:
protection = 0.45f;
DR = 0.45f;
break;
case NPCID.WallofFlesh:
case NPCID.MothronEgg:
protection = 0.5f;
DR = 0.5f;
break;
case NPCID.DungeonGuardian:
protection = 0.999999f;
DR = 0.999999f;
break;
default:
@@ -1351,6 +1346,7 @@ namespace CalamityMod.NPCs
#region Strike NPC
public override bool StrikeNPC(NPC npc, ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit)
{
// TODO -- move this to Destroyer's Rev+ AI; either set his DR or modify npc.takenDamageMultiplier
if (npc.type == NPCID.TheDestroyer || npc.type == NPCID.TheDestroyerBody || npc.type == NPCID.TheDestroyerTail)
{
if ((newAI[1] < 480f || newAI[2] > 0f) && (CalamityWorld.revenge || CalamityWorld.bossRushActive))
@@ -1358,99 +1354,83 @@ namespace CalamityMod.NPCs
damage *= 0.01;
}
}
else if (npc.type == mod.NPCType("SCalWormBody") || npc.type == mod.NPCType("SCalWormHead") || npc.type == mod.NPCType("SCalWormBodyWeak") || npc.type == mod.NPCType("SCalWormTail") || npc.type == mod.NPCType("EidolonWyrmHeadHuge"))
{
damage *= 0.000001;
}
double yellowCandleDamageBoost = damage * 0.05; // Get value before DR
// Yellow Candle provides +5% damage which ignores both DR and defense.
// However, armor penetration bonus damage has already been applied, so it's slightly higher than it should be.
double yellowCandleDamage = 0.05 * damage;
int newDefense = npc.defense -
(pFlames ? 4 : 0) -
(wDeath ? 50 : 0) -
(gsInferno ? 20 : 0) -
(astralInfection ? 8 : 0) -
(aFlames ? 10 : 0) -
(wCleave ? 15 : 0);
// Apply modifications to enemy's current defense based on Calamity debuffs.
// As with defense and DR, flat reductions apply first, then multiplicative reductions.
int effectiveDefense = npc.defense -
(pFlames ? Plague.DefenseReduction : 0) -
(wDeath ? WhisperingDeath.DefenseReduction : 0) -
(gsInferno ? GodSlayerInferno.DefenseReduction : 0) -
(astralInfection ? AstralInfectionDebuff.DefenseReduction : 0) -
(aFlames ? AbyssalFlames.DefenseReduction : 0) -
(wCleave ? WarCleave.DefenseReduction : 0);
if (gState)
{
newDefense /= 2;
}
effectiveDefense /= 2;
if (aCrunch)
{
newDefense /= 3;
}
effectiveDefense /= 3;
if (newDefense < 0)
{
newDefense = 0;
}
// Defense can never be negative and has a minimum value of zero.
if (effectiveDefense < 0)
effectiveDefense = 0;
defense = newDefense;
// Apply vanilla-style defense before DR, using Calamity's reduced defense.
damage = Main.CalculateDamage((int)damage, effectiveDefense);
if (protection > 0f)
{
double newDamage = damage + (defense * 0.25); //defense damage boost 150 * .25 = 45 + 150 = 195 damage 180 defense
// DR applies after vanilla defense.
damage = ApplyDR(npc, damage);
if (marked)
{
protection *= 0.5f;
}
// Add Yellow Candle damage if the NPC isn't supposed to be "near invincible"
if (yellowCandle && DR < 0.99f && npc.takenDamageMultiplier > 0.05f)
damage += yellowCandleDamage;
if (npc.betsysCurse)
{
protection *= 0.66f;
}
if (wCleave)
{
protection *= 0.75f;
}
if (npc.ichor)
{
protection *= 0.75f;
}
else if (npc.onFire2)
{
protection *= 0.8f;
}
if (protection < 0f)
{
protection = 0f;
}
if (newDamage >= 1.0)
{
newDamage = (1f - protection) * newDamage; //DR calc 195 * 0.4 = 78 damage 0.6 DR
if (newDamage < 1.0)
{
newDamage = 1.0;
}
}
damage = newDamage;
protection = defProtection;
}
if (protection < 0.99f)
{
if (yellowCandle)
{
damage += yellowCandleDamageBoost;
}
}
return true; //vanilla defense calc 78 - (180 / 2 = 90) = 0, boosted to 1 by calc
// Cancel out vanilla defense math by reversing the calculation vanilla is about to perform.
// While roundabout, this is safer than returning false to stop vanilla damage calculations entirely.
// Other mods will probably expect the vanilla code to run and may compensate for it themselves.
damage = Main.CalculateDamage((int)damage, -defense);
return true;
}
#endregion
#region Boss Head Slot
public override void BossHeadSlot(NPC npc, ref int index)
/// <summary>
/// Modifies damage incoming to an NPC based on their DR (damage reduction) stat added by Calamity.<br></br>
/// This is entirely separate from vanilla's takenDamageMultiplier.
/// </summary>
/// <param name="damage">Incoming damage. Has been modified by Main.DamageVar and boosted by armor penetration, but nothing else.</param>
/// <returns></returns>
private double ApplyDR(NPC npc, double damage)
{
if (DR <= 0f || damage <= 1.0)
return damage;
float effectiveDR = DR;
if (marked)
effectiveDR *= 0.5f;
if (npc.betsysCurse)
effectiveDR *= 0.66f;
if (wCleave)
effectiveDR *= 0.75f;
// Ichor and Cursed Flames are mutually exclusive
if (npc.ichor)
effectiveDR *= 0.75f;
else if (npc.onFire2)
effectiveDR *= 0.8f;
// DR floor is 0%. Nothing can have negative DR.
if (effectiveDR <= 0f)
effectiveDR = 0f;
double newDamage = (1f - effectiveDR) * damage;
return newDamage < 1.0 ? 1.0 : newDamage;
}
#endregion
#region Boss Head Slot
public override void BossHeadSlot(NPC npc, ref int index)
{
if (CalamityWorld.revenge)
{
@@ -2564,7 +2544,7 @@ namespace CalamityMod.NPCs
public override void OnHitByProjectile(NPC npc, Projectile projectile, int damage, float knockback, bool crit)
{
bool isSummon = projectile.minion || projectile.sentry || CalamityMod.projectileMinionList.Contains(projectile.type);
if (Main.player[projectile.owner].GetCalamityPlayer().sGenerator)
{
if (isSummon && npc.damage > 0)
+1
View File
@@ -22,6 +22,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas
npc.width = 26; //28
npc.height = 18; //28
npc.defense = 0;
npc.takenDamageMultiplier = 1E-6f;
npc.lifeMax = CalamityWorld.revenge ? 1200000 : 1000000;
if (CalamityWorld.death)
{
+2 -1
View File
@@ -30,7 +30,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas
npc.aiStyle = 6;
aiType = -1;
npc.knockBackResist = 0f;
npc.scale = 1.2f;
npc.takenDamageMultiplier = 1E-6f;
npc.scale = 1.2f;
if (Main.expertMode)
{
npc.scale = 1.35f;
+1
View File
@@ -29,6 +29,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas
npc.width = 56; //324
npc.height = 62; //216
npc.defense = 0;
npc.takenDamageMultiplier = 1E-6f;
npc.lifeMax = CalamityWorld.revenge ? 1200000 : 1000000;
if (CalamityWorld.death)
{
+1
View File
@@ -20,6 +20,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas
npc.width = 26; //324
npc.height = 46; //216
npc.defense = 0;
npc.takenDamageMultiplier = 1E-6f;
npc.lifeMax = CalamityWorld.revenge ? 1200000 : 1000000;
if (CalamityWorld.death)
{
+2 -2
View File
@@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Ranged
{
DisplayName.SetDefault("Halley's Comet");
}
public override void SetDefaults()
{
projectile.width = 20;
@@ -97,4 +97,4 @@ namespace CalamityMod.Projectiles.Ranged
target.AddBuff(mod.BuffType("Nightwither"), 300);
}
}
}
}
+2 -2
View File
@@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Ranged
{
DisplayName.SetDefault("Fire");
}
public override void SetDefaults()
{
projectile.width = 12;
@@ -100,4 +100,4 @@ namespace CalamityMod.Projectiles.Ranged
target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(1,4));
}
}
}
}
+3 -3
View File
@@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Rogue
public class BlastBarrelProjectile : ModProjectile
{
public float cooldown = 0f;
public float oldVelocityX = 0f;
public float oldVelocityX = 0f;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Barrel");
@@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Rogue
{
Vector2 fireVelocity = (Vector2.UnitY * (-16f + Main.rand.NextFloat(-3, 12f))).RotatedByRandom((double)MathHelper.ToRadians(40f));
int fireIndex = Projectile.NewProjectile(projectile.Center, projectile.velocity + fireVelocity,
Main.rand.Next(ProjectileID.MolotovFire, ProjectileID.MolotovFire3 + 1),
Main.rand.Next(ProjectileID.MolotovFire, ProjectileID.MolotovFire3 + 1),
BlastBarrel.BaseDamage, 1f, projectile.owner);
Main.projectile[fireIndex].thrown = false;
Main.projectile[fireIndex].GetGlobalProjectile<CalamityGlobalProjectile>(mod).rogue = true;
@@ -97,4 +97,4 @@ namespace CalamityMod.Projectiles.Rogue
return false;
}
}
}
}
+2 -2
View File
@@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Rogue
public class EclipsesStealth : ModProjectile
{
private int deadinside = 0; //used to know when to drop spears from the sky
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Eclipse's Stealth");
@@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Rogue
projectile.localNPCHitCooldown = 30;
projectile.GetGlobalProjectile<CalamityGlobalProjectile>(mod).rogue = true;
}
public override void AI()
{
deadinside++; //congrats Pinkie
+1 -1
View File
@@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Rogue
projectile.alpha += 5;
if (projectile.timeLeft < 75)
projectile.velocity *= 0.95f;
}
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
+1 -1
View File
@@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Rogue
projectile.alpha += 5;
if (projectile.timeLeft < 75)
projectile.velocity *= 0.95f;
}
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
+1 -1
View File
@@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Rogue
projectile.alpha += 5;
if (projectile.timeLeft < 75)
projectile.velocity *= 0.95f;
}
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
+1 -1
View File
@@ -75,4 +75,4 @@ namespace CalamityMod.Projectiles.Rogue
target.AddBuff(BuffID.Venom, 240);
}
}
}
}
@@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Rogue
ProjectileID.Sets.TrailCacheLength[projectile.type] = 6;
ProjectileID.Sets.TrailingMode[projectile.type] = 0;
}
public override void SetDefaults()
{
projectile.width = 26;
@@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Rogue
projectile.timeLeft = 1200;
projectile.GetGlobalProjectile<CalamityGlobalProjectile>(mod).rogue = true;
}
public override void AI()
{
if (Main.rand.Next(5) == 0)
@@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Rogue
Main.dust[num622].velocity *= 1f;
}
if (projectile.owner == Main.myPlayer)
{
{
int num320 = Main.rand.Next(2, 6);
int num3;
for (int num321 = 0; num321 < num320; num321 = num3 + 1)
@@ -83,4 +83,4 @@ namespace CalamityMod.Projectiles.Rogue
return false;
}
}
}
}
+4 -4
View File
@@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Rogue
ProjectileID.Sets.TrailCacheLength[projectile.type] = 6;
ProjectileID.Sets.TrailingMode[projectile.type] = 0;
}
public override void SetDefaults()
{
projectile.width = 26;
@@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Rogue
projectile.usesLocalNPCImmunity = true;
projectile.localNPCHitCooldown = 60;
}
public override void AI()
{
if (Main.rand.Next(5) == 0 && projectile.ai[0] != 1f)
@@ -199,7 +199,7 @@ namespace CalamityMod.Projectiles.Rogue
Main.dust[num622].velocity *= 1f;
}
if (projectile.owner == Main.myPlayer)
{
{
int num320 = Main.rand.Next(2, 6);
int num3;
for (int num321 = 0; num321 < num320; num321 = num3 + 1)
@@ -219,4 +219,4 @@ namespace CalamityMod.Projectiles.Rogue
return false;
}
}
}
}
+5 -5
View File
@@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Summon
ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true;
Main.projFrames[projectile.type] = 3;
}
public override void SetDefaults()
{
projectile.width = 36;
@@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Summon
projectile.minion = true;
target = GetClosestNPCToTarget(maxDistToEnemy, false);
}
public int GetClosestNPCToTarget(float maxDistance, bool ignoreTiles)
{
int closestNPC = -1;
@@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Summon
}
return closestNPC;
}
public override void AI()
{
if (projectile.localAI[0] == 0f)
@@ -278,7 +278,7 @@ namespace CalamityMod.Projectiles.Summon
projectile.netUpdate = true;
}
}
}
}
if (Vector2.Distance(player.Center, projectile.Center) <= 1400 & !returningBackToPlayer) //don't return to player if currently busy dealing with an enemy
{
if (enemyCheckTimer % 240 == 0 & enemyCheckTimer != 0)
@@ -293,4 +293,4 @@ namespace CalamityMod.Projectiles.Summon
return false;
}
}
}
}
+1 -1
View File
@@ -60,4 +60,4 @@ namespace CalamityMod.Tiles
return false;
}
}
}
}
+1 -1
View File
@@ -84,7 +84,7 @@ namespace CalamityMod.Tiles.FurnitureOccult
//Left
if (
CheckTile(Type, true, 1, 0, i, j) && CheckTile(Type, false, 1, 1, i, j) && CheckTile(Type, true, 0, 1, i, j) &&
CheckTile(Type, true, 1, 0, i, j) && CheckTile(Type, false, 1, 1, i, j) && CheckTile(Type, true, 0, 1, i, j) &&
(CheckTile(Type, true, -1, 1, i, j) || CheckTile(Type, false, -1, 0, i, j))
)
{
+11 -2
View File
@@ -1,4 +1,6 @@
using CalamityMod.CalPlayer;
using CalamityMod.NPCs;
using CalamityMod.Projectiles;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using System.Collections.Generic;
@@ -20,7 +22,7 @@ namespace CalamityMod
{
case 1:
return player.GetCalamityPlayer().ZoneAbyssLayer1;
case 2:
return player.GetCalamityPlayer().ZoneAbyssLayer2;
@@ -38,6 +40,8 @@ namespace CalamityMod
public static class CNPCUtils
{
public static CalamityGlobalNPC GetCalamityNPC(this NPC npc) => npc.GetGlobalNPC<CalamityGlobalNPC>();
/// <summary>
/// Allows you to set the lifeMax value of a NPC to different values based on the mode. Called instead of npc.lifeMax = X.
/// </summary>
@@ -66,7 +70,7 @@ namespace CalamityMod
if (npc.boss)
{
double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01;
npc.lifeMax += (int)((double)npc.lifeMax * HPBoost);
npc.lifeMax += (int)((double)npc.lifeMax * HPBoost);
}
}
/// <summary>
@@ -108,6 +112,11 @@ namespace CalamityMod
}
}
public static class CProjectileUtils
{
public static CalamityGlobalProjectile GetCalamityProj(this Projectile proj) => proj.GetGlobalProjectile<CalamityGlobalProjectile>();
}
public static class CMiscUtils
{
public static void AddWithCondition<T>(this List<T> list, T type, bool condition)