35 left!!
- Unmonitored DisplayName usage - Proper Collision.HurtTile integration - Purified ModifyIncomingHit - Another StrikeNPC fix - Tree shake item fetching fix - CanBuyItem -> CanAfford
This commit is contained in:
1 parent
f408d6fffb
commit
514d2c74e0
11 files changed
+34
-59
No files matched your search
@@ -5554,7 +5554,7 @@ namespace CalamityMod.CalPlayer
|
||||
{
|
||||
justHitByDefenseDamage = false;
|
||||
defenseDamageToTake = 0;
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
// If Armageddon is active, instantly kill the player.
|
||||
@@ -6051,8 +6051,8 @@ namespace CalamityMod.CalPlayer
|
||||
}
|
||||
|
||||
// Give bonus immunity frames based on the type of damage dealt
|
||||
if (cooldownCounter != -1)
|
||||
Player.hurtCooldowns[cooldownCounter] += iFramesToAdd;
|
||||
if (hurtInfo.CooldownCounter != -1)
|
||||
Player.hurtCooldowns[hurtInfo.CooldownCounter] += iFramesToAdd;
|
||||
else
|
||||
Player.immuneTime += iFramesToAdd;
|
||||
|
||||
|
||||
@@ -890,12 +890,12 @@ namespace CalamityMod.CalPlayer
|
||||
{
|
||||
// Thorn and spike effects
|
||||
// 10 = crimson/corruption thorns, 17 = jungle thorns, 80 = temple spikes
|
||||
Vector2 tileType;
|
||||
Collision.HurtTile collidedTile;
|
||||
if (!Player.mount.Active || !Player.mount.Cart)
|
||||
tileType = Collision.HurtTiles(Player.position, Player.velocity, Player.width, Player.height, Player.fireWalk);
|
||||
collidedTile = Collision.HurtTiles(Player.position, Player.width, Player.height, Player);
|
||||
else
|
||||
tileType = Collision.HurtTiles(Player.position, Player.velocity, Player.width, Player.height - 16, Player.fireWalk);
|
||||
switch ((int)tileType.Y)
|
||||
collidedTile = Collision.HurtTiles(Player.position, Player.width, Player.height - 16, Player);
|
||||
switch (collidedTile.type)
|
||||
{
|
||||
case 10:
|
||||
Player.AddBuff(BuffID.Weak, 300, false);
|
||||
|
||||
@@ -10,8 +10,6 @@ namespace CalamityMod.Items.Mounts.Minecarts
|
||||
[LegacyName("DoGCart")]
|
||||
public class TheCartofGods : ModItem
|
||||
{
|
||||
public override void SetStaticDefaults() => DisplayName.SetDefault("The Cart of Gods");
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 34;
|
||||
|
||||
+20
-35
@@ -15,7 +15,6 @@ namespace CalamityMod.NPCs.Other
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
this.HideFromBestiary();
|
||||
// DisplayName.SetDefault("Mysterious Portal");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
@@ -41,6 +40,24 @@ namespace CalamityMod.NPCs.Other
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
// Becomes immortal. Any existing Suicide Bomber Demons turn angry.
|
||||
if (NPC.life == 1 && NPC.ai[1] <= 0f)
|
||||
{
|
||||
NPC.ai[1] = 1f;
|
||||
NPC.dontTakeDamage = true;
|
||||
NPC.netUpdate = true;
|
||||
int demonType = ModContent.ProjectileType<SuicideBomberDemon>();
|
||||
for (int i = 0; i < Main.maxProjectiles; i++)
|
||||
{
|
||||
if (Main.projectile[i].type != demonType || !Main.projectile[i].active || Main.projectile[i].hostile)
|
||||
continue;
|
||||
|
||||
Main.projectile[i].hostile = true;
|
||||
Main.projectile[i].friendly = false;
|
||||
Main.projectile[i].netUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
NPC.rotation += 0.18f;
|
||||
NPC.Opacity = Utils.GetLerpValue(0f, 30f, Time, true) * Utils.GetLerpValue(420f, 390f, Time, true);
|
||||
NPC.velocity = Vector2.Zero;
|
||||
@@ -86,40 +103,8 @@ namespace CalamityMod.NPCs.Other
|
||||
return null;
|
||||
}
|
||||
|
||||
public override void ModifyIncomingHit(ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
bool wouldDie = NPC.life - (damage * (crit ? 2D : 1D)) <= 0;
|
||||
if (wouldDie)
|
||||
{
|
||||
NPC.immortal = true;
|
||||
|
||||
// Enrage demons if hit when already at 1 health.
|
||||
if (NPC.life == 1)
|
||||
{
|
||||
int demonType = ModContent.ProjectileType<SuicideBomberDemon>();
|
||||
for (int i = 0; i < Main.maxProjectiles; i++)
|
||||
{
|
||||
if (Main.projectile[i].type != demonType || !Main.projectile[i].active || Main.projectile[i].hostile)
|
||||
continue;
|
||||
|
||||
Main.projectile[i].hostile = true;
|
||||
Main.projectile[i].friendly = false;
|
||||
Main.projectile[i].netUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
NPC.life = 1;
|
||||
damage = 0D;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool CheckDead()
|
||||
{
|
||||
NPC.life = 1;
|
||||
return false;
|
||||
}
|
||||
// This will always put the portal to 1 health before dying, which makes external checks work.
|
||||
public override void ModifyIncomingHit(ref NPC.HitModifiers modifiers) => modifiers.SetMaxDamage(NPC.life - 1);
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
|
||||
{
|
||||
|
||||
@@ -178,8 +178,6 @@ namespace CalamityMod.NPCs.Other
|
||||
{
|
||||
if (Main.myPlayer == NPC.target)
|
||||
NPC.SyncMotionToServer();
|
||||
|
||||
return base.ModifyIncomingHit(ref modifiers);
|
||||
}
|
||||
|
||||
public override void OnKill()
|
||||
|
||||
@@ -130,7 +130,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
if (distanceTo < distance && npc.CanBeChasedBy(Projectile, false) && k != Projectile.localAI[0])
|
||||
{
|
||||
float alldamage = Projectile.damage * 0.5f;
|
||||
double damage = npc.StrikeNPC((int)alldamage, Projectile.knockBack, Projectile.velocity.X > 0f ? 1 : -1, true);
|
||||
double damage = npc.StrikeNPC(npc.CalculateHitInfo((int)alldamage, Projectile.velocity.X > 0f ? 1 : -1, true, Projectile.knockBack));
|
||||
player.addDPS((int)damage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,9 +74,7 @@ namespace CalamityMod.Tiles.Astral
|
||||
else if (Main.rand.NextBool(12))
|
||||
{
|
||||
createLeaves = true;
|
||||
int dropItem = 0;
|
||||
WorldGen.KillTile_GetItemDrops(x, y, Main.tile[x, y], out dropItem, out int _, out int _, out int _);
|
||||
Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, dropItem, Main.rand.Next(1, 4));
|
||||
Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, DropWood(), Main.rand.Next(1, 4));
|
||||
}
|
||||
else if (Main.rand.NextBool(20))
|
||||
{
|
||||
|
||||
@@ -65,12 +65,10 @@ namespace CalamityMod.Tiles.AstralDesert
|
||||
createLeaves = true;
|
||||
Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, ItemID.RottenEgg, randAmt);
|
||||
}
|
||||
else if (Main.rand.NextBool(12))
|
||||
else if (Main.rand.NextBool(12)) // 1-3 Astral Monolith
|
||||
{
|
||||
createLeaves = true;
|
||||
int dropItem = 0;
|
||||
WorldGen.KillTile_GetItemDrops(x, y, Main.tile[x, y], out dropItem, out int _, out int _, out int _);
|
||||
Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, dropItem, Main.rand.Next(1, 4));
|
||||
Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, DropWood(), Main.rand.Next(1, 4));
|
||||
}
|
||||
else if (Main.rand.NextBool(20))
|
||||
{
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace CalamityMod.Tiles.AstralDesert
|
||||
|
||||
AddMapEntry(new Color(187, 220, 237));
|
||||
|
||||
TileID.Sets.TouchDamageSands/* tModPorter Suggestion: Suffocate */[Type] = 15;
|
||||
TileID.Sets.Suffocate[Type] = true;
|
||||
TileID.Sets.CanBeDugByShovel[Type] = true;
|
||||
TileID.Sets.Conversion.Sand[Type] = true;
|
||||
TileID.Sets.ForAdvancedCollision.ForSandshark[Type] = true;
|
||||
|
||||
@@ -78,9 +78,7 @@ namespace CalamityMod.Tiles.AstralSnow
|
||||
else if (Main.rand.NextBool(12))
|
||||
{
|
||||
createLeaves = true;
|
||||
int dropItem = 0;
|
||||
WorldGen.KillTile_GetItemDrops(x, y, Main.tile[x, y], out dropItem, out int _, out int _, out int _);
|
||||
Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, dropItem, Main.rand.Next(1, 4));
|
||||
Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, DropWood(), Main.rand.Next(1, 4));
|
||||
}
|
||||
else if (Main.rand.NextBool(20))
|
||||
{
|
||||
|
||||
@@ -366,7 +366,7 @@ namespace CalamityMod.UI.CalamitasEnchants
|
||||
return;
|
||||
|
||||
// If there is no cost or the player cannot afford it, do nothing.
|
||||
if (cost <= 0 || !Main.LocalPlayer.CanBuyItem(cost))
|
||||
if (cost <= 0 || !Main.LocalPlayer.CanAfford(cost))
|
||||
return;
|
||||
|
||||
Item originalItem = CurrentlyHeldItem.Clone();
|
||||
|
||||
Reference in new issue
Block a user