added an ActiveItem utility
This commit is contained in:
1 parent
d61dd10b16
commit
db9ccff61b
34 files changed
+151
-150
No files matched your search
+13
-13
@@ -2726,7 +2726,7 @@ namespace CalamityMod.CalPlayer
|
||||
}
|
||||
if (CalamityMod.RageHotKey.JustPressed)
|
||||
{
|
||||
if (gaelRageCooldown == 0 && player.HeldItem.type == ModContent.ItemType<GaelsGreatsword>() &&
|
||||
if (gaelRageCooldown == 0 && player.ActiveItem().type == ModContent.ItemType<GaelsGreatsword>() &&
|
||||
rage > 0)
|
||||
{
|
||||
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SilvaDispel"), (int)player.position.X, (int)player.position.Y);
|
||||
@@ -3376,12 +3376,12 @@ namespace CalamityMod.CalPlayer
|
||||
{
|
||||
CalamityPlayerMiscEffects.CalamityPostUpdateMiscEffects(player, mod);
|
||||
|
||||
if (player.HeldItem.type == ModContent.ItemType<GaelsGreatsword>())
|
||||
if (player.ActiveItem().type == ModContent.ItemType<GaelsGreatsword>())
|
||||
{
|
||||
gaelSwitchTimer = GaelSwitchPhase.LoseRage;
|
||||
rage += (int)MathHelper.Min(5, 10000 - rage);
|
||||
}
|
||||
else if (player.HeldItem.type != ModContent.ItemType<GaelsGreatsword>() && gaelSwitchTimer == GaelSwitchPhase.LoseRage)
|
||||
else if (player.ActiveItem().type != ModContent.ItemType<GaelsGreatsword>() && gaelSwitchTimer == GaelSwitchPhase.LoseRage)
|
||||
{
|
||||
rage = 0;
|
||||
gaelSwitchTimer = GaelSwitchPhase.None;
|
||||
@@ -3584,7 +3584,7 @@ namespace CalamityMod.CalPlayer
|
||||
#region Pre Kill
|
||||
public override bool PreKill(double damage, int hitDirection, bool pvp, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource)
|
||||
{
|
||||
if (invincible && player.inventory[player.selectedItem].type != ModContent.ItemType<ColdheartIcicle>())
|
||||
if (invincible && player.ActiveItem().type != ModContent.ItemType<ColdheartIcicle>())
|
||||
{
|
||||
if (player.statLife <= 0)
|
||||
{
|
||||
@@ -4410,7 +4410,7 @@ namespace CalamityMod.CalPlayer
|
||||
{
|
||||
target.AddBuff(BuffID.Midas, 120, false);
|
||||
}
|
||||
if (ZoneCalamity && CalamityMod.fireWeaponList.Contains(player.inventory[player.selectedItem].type))
|
||||
if (ZoneCalamity && CalamityMod.fireWeaponList.Contains(player.ActiveItem().type))
|
||||
{
|
||||
target.AddBuff(ModContent.BuffType<AbyssalFlames>(), 240, false);
|
||||
}
|
||||
@@ -4728,7 +4728,7 @@ namespace CalamityMod.CalPlayer
|
||||
{
|
||||
target.AddBuff(BuffID.Midas, 120, false);
|
||||
}
|
||||
if (ZoneCalamity && CalamityMod.fireWeaponList.Contains(player.inventory[player.selectedItem].type))
|
||||
if (ZoneCalamity && CalamityMod.fireWeaponList.Contains(player.ActiveItem().type))
|
||||
{
|
||||
target.AddBuff(ModContent.BuffType<AbyssalFlames>(), 240, false);
|
||||
}
|
||||
@@ -4745,7 +4745,7 @@ namespace CalamityMod.CalPlayer
|
||||
target.AddBuff(BuffID.Venom, 120, false);
|
||||
}
|
||||
}
|
||||
if (proj.type == ProjectileID.IchorArrow && player.inventory[player.selectedItem].type == ModContent.ItemType<RaidersGlory>())
|
||||
if (proj.type == ProjectileID.IchorArrow && player.ActiveItem().type == ModContent.ItemType<RaidersGlory>())
|
||||
{
|
||||
target.AddBuff(BuffID.Midas, 300, false);
|
||||
}
|
||||
@@ -4985,7 +4985,7 @@ namespace CalamityMod.CalPlayer
|
||||
bool isSummon = proj.minion || proj.sentry || CalamityMod.projectileMinionList.Contains(proj.type);
|
||||
bool hasClassType = proj.melee || proj.ranged || proj.magic || isSummon || proj.Calamity().rogue;
|
||||
|
||||
Item heldItem = player.inventory[player.selectedItem];
|
||||
Item heldItem = player.ActiveItem();
|
||||
|
||||
if (isTrueMelee && soaring)
|
||||
{
|
||||
@@ -5629,7 +5629,7 @@ namespace CalamityMod.CalPlayer
|
||||
{
|
||||
if (CalamityMod.projectileDestroyExceptionList.TrueForAll(x => proj.type != x))
|
||||
{
|
||||
if (player.HeldItem.type == ModContent.ItemType<GaelsGreatsword>()
|
||||
if (player.ActiveItem().type == ModContent.ItemType<GaelsGreatsword>()
|
||||
&& proj.active && proj.hostile && player.altFunctionUse == 2 && Main.rand.NextBool(2))
|
||||
{
|
||||
for (int j = 0; j < 3; j++)
|
||||
@@ -6141,7 +6141,7 @@ namespace CalamityMod.CalPlayer
|
||||
}
|
||||
}
|
||||
|
||||
if (lol || (invincible && player.inventory[player.selectedItem].type != ModContent.ItemType<ColdheartIcicle>()))
|
||||
if (lol || (invincible && player.ActiveItem().type != ModContent.ItemType<ColdheartIcicle>()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -6233,7 +6233,7 @@ namespace CalamityMod.CalPlayer
|
||||
{
|
||||
damage = (int)(damage * 0.7);
|
||||
}
|
||||
if (player.ownedProjectileCounts[ModContent.ProjectileType<EnergyShell>()] > 0 && player.HeldItem.type == ModContent.ItemType<LionHeart>())
|
||||
if (player.ownedProjectileCounts[ModContent.ProjectileType<EnergyShell>()] > 0 && player.ActiveItem().type == ModContent.ItemType<LionHeart>())
|
||||
{
|
||||
damage = (int)(damage * 0.5);
|
||||
}
|
||||
@@ -9296,7 +9296,7 @@ namespace CalamityMod.CalPlayer
|
||||
// This doesn't trigger stealth strike effects (ConsumeStealthStrike instead of StealthStrike)
|
||||
// so non-rogue weapons can't call lasers down from the sky and such.
|
||||
// Using any item which deals no damage or is a tool doesn't consume stealth.
|
||||
Item it = player.HeldItem;
|
||||
Item it = player.ActiveItem();
|
||||
bool hasDamage = it.damage > 0;
|
||||
bool hasHitboxes = !it.noMelee || it.shoot > 0;
|
||||
bool isPickaxe = it.pick > 0;
|
||||
@@ -9354,7 +9354,7 @@ namespace CalamityMod.CalPlayer
|
||||
stealthGenMoving += 0.15f;
|
||||
}
|
||||
|
||||
if (CalamityMod.daggerList.Contains(player.inventory[player.selectedItem].type) && player.invis)
|
||||
if (CalamityMod.daggerList.Contains(player.ActiveItem().type) && player.invis)
|
||||
{
|
||||
stealthGenStandstill += 0.08f;
|
||||
stealthGenMoving += 0.08f;
|
||||
|
||||
@@ -591,7 +591,7 @@ namespace CalamityMod.CalPlayer
|
||||
if (modPlayer.ZoneAbyss || modPlayer.ZoneSulphur)
|
||||
canSulphurFish = true;
|
||||
|
||||
Item item = player.inventory[player.selectedItem];
|
||||
Item item = player.ActiveItem();
|
||||
if (!canSulphurFish || item.fishingPole <= 0 || item.holdStyle != 1)
|
||||
fishingLevel = -1;
|
||||
}
|
||||
|
||||
@@ -1278,7 +1278,7 @@ namespace CalamityMod.CalPlayer
|
||||
player.endurance += 0.01f;
|
||||
player.statDefense += 2;
|
||||
}
|
||||
if (!modPlayer.polarisBoost || player.inventory[player.selectedItem].type != ModContent.ItemType<PolarisParrotfish>())
|
||||
if (!modPlayer.polarisBoost || player.ActiveItem().type != ModContent.ItemType<PolarisParrotfish>())
|
||||
{
|
||||
modPlayer.polarisBoost = false;
|
||||
if (player.FindBuffIndex(ModContent.BuffType<PolarisBuff>()) > -1)
|
||||
@@ -2534,27 +2534,27 @@ namespace CalamityMod.CalPlayer
|
||||
}
|
||||
}
|
||||
|
||||
if (CalamityMod.scopedWeaponList.Contains(player.inventory[player.selectedItem].type))
|
||||
if (CalamityMod.scopedWeaponList.Contains(player.ActiveItem().type))
|
||||
player.scope = true;
|
||||
|
||||
if (CalamityMod.highTestFishList.Contains(player.inventory[player.selectedItem].type))
|
||||
if (CalamityMod.highTestFishList.Contains(player.ActiveItem().type))
|
||||
player.accFishingLine = true;
|
||||
|
||||
if (CalamityMod.boomerangList.Contains(player.inventory[player.selectedItem].type) && player.invis)
|
||||
if (CalamityMod.boomerangList.Contains(player.ActiveItem().type) && player.invis)
|
||||
modPlayer.throwingDamage += 0.1f;
|
||||
|
||||
if (CalamityMod.javelinList.Contains(player.inventory[player.selectedItem].type) && player.invis)
|
||||
if (CalamityMod.javelinList.Contains(player.ActiveItem().type) && player.invis)
|
||||
player.armorPenetration += 5;
|
||||
|
||||
if (CalamityMod.flaskBombList.Contains(player.inventory[player.selectedItem].type) && player.invis)
|
||||
if (CalamityMod.flaskBombList.Contains(player.ActiveItem().type) && player.invis)
|
||||
modPlayer.throwingVelocity += 0.1f;
|
||||
|
||||
if (CalamityMod.spikyBallList.Contains(player.inventory[player.selectedItem].type) && player.invis)
|
||||
if (CalamityMod.spikyBallList.Contains(player.ActiveItem().type) && player.invis)
|
||||
modPlayer.throwingCrit += 10;
|
||||
|
||||
if (modPlayer.planarSpeedBoost != 0)
|
||||
{
|
||||
if (player.inventory[player.selectedItem].type != ModContent.ItemType<PrideHuntersPlanarRipper>())
|
||||
if (player.ActiveItem().type != ModContent.ItemType<PrideHuntersPlanarRipper>())
|
||||
modPlayer.planarSpeedBoost = 0;
|
||||
}
|
||||
|
||||
@@ -2564,10 +2564,10 @@ namespace CalamityMod.CalPlayer
|
||||
!modPlayer.ZoneSunkenSea && !player.ZoneSnow && !player.ZoneCorrupt && !player.ZoneCrimson && !player.ZoneHoly &&
|
||||
!player.ZoneDesert && !player.ZoneUndergroundDesert && !player.ZoneGlowshroom && !player.ZoneDungeon && !player.ZoneBeach && !player.ZoneMeteor;
|
||||
|
||||
if (player.ZoneUnderworldHeight && !modPlayer.ZoneCalamity && CalamityMod.fireWeaponList.Contains(player.inventory[player.selectedItem].type))
|
||||
if (player.ZoneUnderworldHeight && !modPlayer.ZoneCalamity && CalamityMod.fireWeaponList.Contains(player.ActiveItem().type))
|
||||
player.endurance += 0.03f;
|
||||
|
||||
if ((player.ZoneDesert || player.ZoneUndergroundDesert) && CalamityMod.daggerList.Contains(player.inventory[player.selectedItem].type))
|
||||
if ((player.ZoneDesert || player.ZoneUndergroundDesert) && CalamityMod.daggerList.Contains(player.ActiveItem().type))
|
||||
player.scope = true;
|
||||
|
||||
if (modPlayer.ZoneSunkenSea)
|
||||
@@ -2576,7 +2576,7 @@ namespace CalamityMod.CalPlayer
|
||||
player.ignoreWater = true;
|
||||
}
|
||||
|
||||
if (player.ZoneSnow && CalamityMod.iceWeaponList.Contains(player.inventory[player.selectedItem].type))
|
||||
if (player.ZoneSnow && CalamityMod.iceWeaponList.Contains(player.ActiveItem().type))
|
||||
player.statDefense += 5;
|
||||
|
||||
if (modPlayer.ZoneAstral)
|
||||
@@ -2585,7 +2585,7 @@ namespace CalamityMod.CalPlayer
|
||||
player.wingTimeMax = (int)((double)player.wingTimeMax * 1.05);
|
||||
}
|
||||
|
||||
if (player.ZoneJungle && CalamityMod.natureWeaponList.Contains(player.inventory[player.selectedItem].type))
|
||||
if (player.ZoneJungle && CalamityMod.natureWeaponList.Contains(player.ActiveItem().type))
|
||||
player.AddBuff(BuffID.DryadsWard, 5, true); // Dryad's Blessing
|
||||
|
||||
if (modPlayer.ZoneAbyss)
|
||||
@@ -2605,7 +2605,7 @@ namespace CalamityMod.CalPlayer
|
||||
player.endurance += 0.05f;
|
||||
}
|
||||
|
||||
if (player.ZoneRockLayerHeight && ZoneForest && CalamityMod.flaskBombList.Contains(player.inventory[player.selectedItem].type))
|
||||
if (player.ZoneRockLayerHeight && ZoneForest && CalamityMod.flaskBombList.Contains(player.ActiveItem().type))
|
||||
player.blackBelt = true;
|
||||
|
||||
if (player.ZoneHoly)
|
||||
@@ -3160,7 +3160,7 @@ namespace CalamityMod.CalPlayer
|
||||
}
|
||||
|
||||
// Navy Fishing Rod's electric aura when in-use
|
||||
if (player.inventory[player.selectedItem].type == ModContent.ItemType<NavyFishingRod>() && player.ownedProjectileCounts[ModContent.ProjectileType<NavyBobber>()] != 0)
|
||||
if (player.ActiveItem().type == ModContent.ItemType<NavyFishingRod>() && player.ownedProjectileCounts[ModContent.ProjectileType<NavyBobber>()] != 0)
|
||||
{
|
||||
const int FramesPerHit = 120;
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace CalamityMod.Items.Accessories
|
||||
|
||||
Item heldItem = null;
|
||||
if (player.selectedItem >= 0 && player.selectedItem < Main.maxInventory)
|
||||
heldItem = player.inventory[player.selectedItem];
|
||||
heldItem = player.ActiveItem();
|
||||
|
||||
// Replace the vanilla tooltip with a full stat readout
|
||||
foreach (TooltipLine l in list)
|
||||
|
||||
@@ -68,13 +68,13 @@ namespace CalamityMod.Items.Accessories
|
||||
}
|
||||
}
|
||||
}
|
||||
if (player.HeldItem != null && !player.HeldItem.IsAir && player.HeldItem.stack > 0)
|
||||
if (player.ActiveItem() != null && !player.ActiveItem().IsAir && player.ActiveItem().stack > 0)
|
||||
{
|
||||
bool summon = player.HeldItem.summon;
|
||||
bool rogue = player.HeldItem.Calamity().rogue;
|
||||
bool melee = player.HeldItem.melee;
|
||||
bool ranged = player.HeldItem.ranged;
|
||||
bool magic = player.HeldItem.magic;
|
||||
bool summon = player.ActiveItem().summon;
|
||||
bool rogue = player.ActiveItem().Calamity().rogue;
|
||||
bool melee = player.ActiveItem().melee;
|
||||
bool ranged = player.ActiveItem().ranged;
|
||||
bool magic = player.ActiveItem().magic;
|
||||
if (summon)
|
||||
{
|
||||
player.minionKB += 0.10f;
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace CalamityMod.Items.Ammo
|
||||
|
||||
public override bool ConsumeAmmo(Player player)
|
||||
{
|
||||
return !(player.itemAnimation < player.HeldItem.useAnimation - 3);
|
||||
return !(player.itemAnimation < player.ActiveItem().useAnimation - 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -650,7 +650,7 @@ namespace CalamityMod.Items
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (player.HeldItem.type == ModContent.ItemType<IgneousExaltation>())
|
||||
if (player.ActiveItem().type == ModContent.ItemType<IgneousExaltation>())
|
||||
{
|
||||
bool hasBlades = false;
|
||||
for (int i = 0; i < Main.projectile.Length; i++)
|
||||
@@ -684,7 +684,7 @@ namespace CalamityMod.Items
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (player.HeldItem.type == ModContent.ItemType<ColdDivinity>())
|
||||
if (player.ActiveItem().type == ModContent.ItemType<ColdDivinity>())
|
||||
{
|
||||
bool canContinue = true;
|
||||
int count = 0;
|
||||
|
||||
@@ -604,7 +604,7 @@ namespace CalamityMod.Projectiles
|
||||
{
|
||||
if (projectile.timeLeft > 570) //all of these have a time left of 600 or 660
|
||||
{
|
||||
if (player.inventory[player.selectedItem].type == ItemID.BeesKnees)
|
||||
if (player.ActiveItem().type == ItemID.BeesKnees)
|
||||
{
|
||||
projectile.magic = false;
|
||||
projectile.ranged = true;
|
||||
|
||||
@@ -61,14 +61,14 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
|
||||
}
|
||||
if (flag && Main.myPlayer == projectile.owner && fireLasers)
|
||||
{
|
||||
int weaponDamage2 = player.GetWeaponDamage(player.inventory[player.selectedItem]);
|
||||
int weaponDamage2 = player.GetWeaponDamage(player.ActiveItem());
|
||||
bool flag2 = player.channel && !player.noItems && !player.CCed;
|
||||
if (flag2)
|
||||
{
|
||||
// Consume 2 ammo per shot
|
||||
CalamityGlobalItem.ConsumeAdditionalAmmo(player, player.inventory[player.selectedItem], 2);
|
||||
CalamityGlobalItem.ConsumeAdditionalAmmo(player, player.ActiveItem(), 2);
|
||||
|
||||
float scaleFactor = player.inventory[player.selectedItem].shootSpeed * projectile.scale;
|
||||
float scaleFactor = player.ActiveItem().shootSpeed * projectile.scale;
|
||||
Vector2 value2 = vector;
|
||||
Vector2 value3 = Main.screenPosition + new Vector2(Main.mouseX, Main.mouseY) - value2;
|
||||
if (player.gravDir == -1f)
|
||||
|
||||
@@ -26,14 +26,14 @@ namespace CalamityMod.Projectiles.Healing
|
||||
if (projectile.localAI[0] == 0f)
|
||||
{
|
||||
Player player = Main.player[projectile.owner];
|
||||
if ((player.inventory[player.selectedItem].summon &&
|
||||
!player.inventory[player.selectedItem].melee &&
|
||||
!player.inventory[player.selectedItem].ranged &&
|
||||
!player.inventory[player.selectedItem].magic &&
|
||||
!player.inventory[player.selectedItem].Calamity().rogue) ||
|
||||
player.inventory[player.selectedItem].hammer > 0 ||
|
||||
player.inventory[player.selectedItem].pick > 0 ||
|
||||
player.inventory[player.selectedItem].axe > 0)
|
||||
if ((player.ActiveItem().summon &&
|
||||
!player.ActiveItem().melee &&
|
||||
!player.ActiveItem().ranged &&
|
||||
!player.ActiveItem().magic &&
|
||||
!player.ActiveItem().Calamity().rogue) ||
|
||||
player.ActiveItem().hammer > 0 ||
|
||||
player.ActiveItem().pick > 0 ||
|
||||
player.ActiveItem().axe > 0)
|
||||
{
|
||||
projectile.timeLeft = 600;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
num26 = 5f;
|
||||
}
|
||||
projectile.damage = (int)((float)player.inventory[player.selectedItem].damage * player.magicDamage);
|
||||
projectile.damage = (int)(player.ActiveItem().damage * player.MagicDamage());
|
||||
projectile.ai[0] += 1f;
|
||||
projectile.ai[1] += 1f;
|
||||
if (projectile.localAI[0] == 0f)
|
||||
@@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Magic
|
||||
flag10 = true;
|
||||
if (Main.myPlayer == projectile.owner)
|
||||
{
|
||||
float scaleFactor5 = player.inventory[player.selectedItem].shootSpeed * projectile.scale;
|
||||
float scaleFactor5 = player.ActiveItem().shootSpeed * projectile.scale;
|
||||
Vector2 value12 = vector;
|
||||
Vector2 value13 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - value12;
|
||||
if (player.gravDir == -1f)
|
||||
@@ -129,7 +129,7 @@ namespace CalamityMod.Projectiles.Magic
|
||||
}
|
||||
if (flag10 && Main.myPlayer == projectile.owner)
|
||||
{
|
||||
bool flag11 = !flag9 || player.CheckMana(player.inventory[player.selectedItem].mana, true, false);
|
||||
bool flag11 = !flag9 || player.CheckMana(player.ActiveItem().mana, true, false);
|
||||
bool flag12 = player.channel && flag11 && !player.noItems && !player.CCed;
|
||||
if (flag12)
|
||||
{
|
||||
|
||||
@@ -146,12 +146,12 @@ namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
int num42 = ModContent.ProjectileType<GhastlyBlast>();
|
||||
float scaleFactor11 = 6f;
|
||||
int weaponDamage2 = player.GetWeaponDamage(player.inventory[player.selectedItem]);
|
||||
float weaponKnockback2 = player.inventory[player.selectedItem].knockBack;
|
||||
int weaponDamage2 = player.GetWeaponDamage(player.ActiveItem());
|
||||
float weaponKnockback2 = player.ActiveItem().knockBack;
|
||||
if (flag16)
|
||||
{
|
||||
weaponKnockback2 = player.GetWeaponKnockback(player.inventory[player.selectedItem], weaponKnockback2);
|
||||
float scaleFactor12 = player.inventory[player.selectedItem].shootSpeed * projectile.scale;
|
||||
weaponKnockback2 = player.GetWeaponKnockback(player.ActiveItem(), weaponKnockback2);
|
||||
float scaleFactor12 = player.ActiveItem().shootSpeed * projectile.scale;
|
||||
Vector2 vector19 = vector;
|
||||
Vector2 value18 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - vector19;
|
||||
if (player.gravDir == -1f)
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Magic
|
||||
projectile.active = false;
|
||||
return;
|
||||
}
|
||||
if (!player.inventory[player.selectedItem].magic || player.inventory[player.selectedItem].shoot != ModContent.ProjectileType<MelterNote1>())
|
||||
if (!player.ActiveItem().magic || player.ActiveItem().shoot != ModContent.ProjectileType<MelterNote1>())
|
||||
{
|
||||
projectile.active = false;
|
||||
return;
|
||||
|
||||
@@ -75,11 +75,11 @@ namespace CalamityMod.Projectiles.Magic
|
||||
}
|
||||
if (flag && Main.myPlayer == projectile.owner)
|
||||
{
|
||||
int weaponDamage2 = player.GetWeaponDamage(player.inventory[player.selectedItem]);
|
||||
bool flag2 = player.channel && player.CheckMana(player.inventory[player.selectedItem].mana, true, false) && !player.noItems && !player.CCed;
|
||||
int weaponDamage2 = player.GetWeaponDamage(player.ActiveItem());
|
||||
bool flag2 = player.channel && player.CheckMana(player.ActiveItem().mana, true, false) && !player.noItems && !player.CCed;
|
||||
if (flag2)
|
||||
{
|
||||
float scaleFactor = player.inventory[player.selectedItem].shootSpeed * projectile.scale;
|
||||
float scaleFactor = player.ActiveItem().shootSpeed * projectile.scale;
|
||||
Vector2 value2 = vector;
|
||||
Vector2 value3 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - value2;
|
||||
if (player.gravDir == -1f)
|
||||
|
||||
@@ -238,7 +238,7 @@ namespace CalamityMod.Projectiles.Magic
|
||||
}
|
||||
else {
|
||||
// Do we still have enough mana? If not, we kill the projectile because we cannot use it anymore
|
||||
if (Main.time % 10 < 1 && !player.CheckMana(player.inventory[player.selectedItem].mana, true))
|
||||
if (Main.time % 10 < 1 && !player.CheckMana(player.ActiveItem().mana, true))
|
||||
{
|
||||
projectile.Kill();
|
||||
}
|
||||
|
||||
@@ -75,11 +75,11 @@ namespace CalamityMod.Projectiles.Magic
|
||||
}
|
||||
if (flag && Main.myPlayer == projectile.owner)
|
||||
{
|
||||
int weaponDamage2 = player.GetWeaponDamage(player.inventory[player.selectedItem]);
|
||||
bool flag2 = player.channel && player.CheckMana(player.inventory[player.selectedItem].mana, true, false) && !player.noItems && !player.CCed;
|
||||
int weaponDamage2 = player.GetWeaponDamage(player.ActiveItem());
|
||||
bool flag2 = player.channel && player.CheckMana(player.ActiveItem().mana, true, false) && !player.noItems && !player.CCed;
|
||||
if (flag2)
|
||||
{
|
||||
float scaleFactor = player.inventory[player.selectedItem].shootSpeed * projectile.scale;
|
||||
float scaleFactor = player.ActiveItem().shootSpeed * projectile.scale;
|
||||
Vector2 value2 = vector;
|
||||
Vector2 value3 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - value2;
|
||||
if (player.gravDir == -1f)
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Magic
|
||||
// Calculate how quickly the staff should charge. Charge increases by some number close to 1 every frame.
|
||||
// Speed increasing reforges make this number greater than 1. Slowing reforges make it smaller than 1.
|
||||
if (projectile.localAI[0] == 0f)
|
||||
projectile.localAI[0] = 47f / Main.player[projectile.owner].HeldItem.useTime;
|
||||
projectile.localAI[0] = 47f / player.ActiveItem().useTime;
|
||||
|
||||
// Increment the timer for the staff. If the timer has passed 47, destroy it.
|
||||
projectile.ai[0] += projectile.localAI[0];
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Magic
|
||||
Vector2 rrp = player.RotatedRelativePoint(player.MountedCenter, true);
|
||||
|
||||
// Update damage based on curent magic damage stat (so Mana Sickness affects it)
|
||||
projectile.damage = (int)((player.HeldItem?.damage ?? 0) * player.MagicDamage());
|
||||
projectile.damage = (int)((player.ActiveItem()?.damage ?? 0) * player.MagicDamage());
|
||||
|
||||
// ai[0] is the overall frame counter.
|
||||
projectile.ai[0] += 1f;
|
||||
@@ -77,11 +77,11 @@ namespace CalamityMod.Projectiles.Magic
|
||||
if (projectile.owner == Main.myPlayer)
|
||||
{
|
||||
// Scale seemingly never changes, so this just scales with shoot speed (Yharim's Crystal is 30 by default)
|
||||
float speedTimesScale = player.inventory[player.selectedItem].shootSpeed * projectile.scale;
|
||||
float speedTimesScale = player.ActiveItem().shootSpeed * projectile.scale;
|
||||
UpdateAim(rrp, speedTimesScale);
|
||||
|
||||
// CheckMana returns true if the mana cost can be paid. If mana isn't consumed this frame, the CheckMana short-circuits out of being evaluated.
|
||||
bool allowContinuedUse = !ShouldConsumeMana() || player.CheckMana(player.inventory[player.selectedItem].mana, true, false);
|
||||
bool allowContinuedUse = !ShouldConsumeMana() || player.CheckMana(player.ActiveItem().mana, true, false);
|
||||
bool crystalStillInUse = player.channel && allowContinuedUse && !player.noItems && !player.CCed;
|
||||
|
||||
// The beams are only projected once (on frame 1).
|
||||
|
||||
@@ -67,8 +67,8 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
float scaleFactor6 = 1f;
|
||||
|
||||
if (player.inventory[player.selectedItem].shoot == projectile.type)
|
||||
scaleFactor6 = player.inventory[player.selectedItem].shootSpeed * projectile.scale;
|
||||
if (player.ActiveItem().shoot == projectile.type)
|
||||
scaleFactor6 = player.ActiveItem().shootSpeed * projectile.scale;
|
||||
|
||||
Vector2 vector13 = Main.MouseWorld - vector;
|
||||
vector13.Normalize();
|
||||
|
||||
@@ -53,9 +53,9 @@ namespace CalamityMod.Projectiles.Melee
|
||||
if (player.channel && !player.noItems && !player.CCed)
|
||||
{
|
||||
float scaleFactor6 = 1f;
|
||||
if (player.inventory[player.selectedItem].shoot == projectile.type)
|
||||
if (player.ActiveItem().shoot == projectile.type)
|
||||
{
|
||||
scaleFactor6 = player.inventory[player.selectedItem].shootSpeed * projectile.scale;
|
||||
scaleFactor6 = player.ActiveItem().shootSpeed * projectile.scale;
|
||||
}
|
||||
Vector2 vector13 = Main.MouseWorld - vector;
|
||||
vector13.Normalize();
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Pets
|
||||
|
||||
if (new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height).Intersects(new Rectangle((int)item.position.X, (int)item.position.Y, item.width, item.height)))
|
||||
{
|
||||
if (projectile.owner == Main.myPlayer && (player.inventory[player.selectedItem].type != 0 || player.itemAnimation <= 0))
|
||||
if (projectile.owner == Main.myPlayer && (player.ActiveItem().type != 0 || player.itemAnimation <= 0))
|
||||
{
|
||||
// TODO, fix this maybe?
|
||||
if (!ItemLoader.OnPickup(item, player))
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
projectile.ai[1] = (float)(num40 - num41 * num39);
|
||||
flag15 = true;
|
||||
}
|
||||
bool flag16 = player.channel && player.HasAmmo(player.inventory[player.selectedItem], true) && !player.noItems && !player.CCed;
|
||||
bool flag16 = player.channel && player.HasAmmo(player.ActiveItem(), true) && !player.noItems && !player.CCed;
|
||||
if (projectile.localAI[0] > 0f)
|
||||
{
|
||||
projectile.localAI[0] -= 1f;
|
||||
@@ -103,13 +103,13 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
int num42 = 14;
|
||||
float scaleFactor11 = 14f;
|
||||
int weaponDamage2 = player.GetWeaponDamage(player.inventory[player.selectedItem]);
|
||||
float weaponKnockback2 = player.inventory[player.selectedItem].knockBack;
|
||||
int weaponDamage2 = player.GetWeaponDamage(player.ActiveItem());
|
||||
float weaponKnockback2 = player.ActiveItem().knockBack;
|
||||
if (flag16)
|
||||
{
|
||||
player.PickAmmo(player.inventory[player.selectedItem], ref num42, ref scaleFactor11, ref flag16, ref weaponDamage2, ref weaponKnockback2, false);
|
||||
weaponKnockback2 = player.GetWeaponKnockback(player.inventory[player.selectedItem], weaponKnockback2);
|
||||
float scaleFactor12 = player.inventory[player.selectedItem].shootSpeed * projectile.scale;
|
||||
player.PickAmmo(player.ActiveItem(), ref num42, ref scaleFactor11, ref flag16, ref weaponDamage2, ref weaponKnockback2, false);
|
||||
weaponKnockback2 = player.GetWeaponKnockback(player.ActiveItem(), weaponKnockback2);
|
||||
float scaleFactor12 = player.ActiveItem().shootSpeed * projectile.scale;
|
||||
Vector2 vector19 = vector;
|
||||
Vector2 value18 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - vector19;
|
||||
if (player.gravDir == -1f)
|
||||
|
||||
@@ -85,10 +85,10 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
}
|
||||
if (flag && Main.myPlayer == projectile.owner)
|
||||
{
|
||||
bool flag2 = player.channel && player.CheckMana(player.inventory[player.selectedItem].mana, true, false) && !player.noItems && !player.CCed;
|
||||
bool flag2 = player.channel && player.CheckMana(player.ActiveItem().mana, true, false) && !player.noItems && !player.CCed;
|
||||
if (flag2)
|
||||
{
|
||||
float scaleFactor = player.inventory[player.selectedItem].shootSpeed * projectile.scale;
|
||||
float scaleFactor = player.ActiveItem().shootSpeed * projectile.scale;
|
||||
Vector2 value2 = vector;
|
||||
Vector2 value3 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - value2;
|
||||
if (player.gravDir == -1f)
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
flag15 = true;
|
||||
int arg_1EF4_0 = (int)projectile.ai[0] / (num40 - num41 * num39);
|
||||
}
|
||||
bool flag16 = player.channel && player.HasAmmo(player.inventory[player.selectedItem], true) && !player.noItems && !player.CCed;
|
||||
bool flag16 = player.channel && player.HasAmmo(player.ActiveItem(), true) && !player.noItems && !player.CCed;
|
||||
if (projectile.localAI[0] > 0f)
|
||||
{
|
||||
projectile.localAI[0] -= 1f;
|
||||
@@ -92,13 +92,13 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
int num42 = 14;
|
||||
float scaleFactor11 = 14f;
|
||||
int weaponDamage2 = player.GetWeaponDamage(player.inventory[player.selectedItem]);
|
||||
float weaponKnockback2 = player.inventory[player.selectedItem].knockBack;
|
||||
int weaponDamage2 = player.GetWeaponDamage(player.ActiveItem());
|
||||
float weaponKnockback2 = player.ActiveItem().knockBack;
|
||||
if (flag16)
|
||||
{
|
||||
player.PickAmmo(player.inventory[player.selectedItem], ref num42, ref scaleFactor11, ref flag16, ref weaponDamage2, ref weaponKnockback2, false);
|
||||
weaponKnockback2 = player.GetWeaponKnockback(player.inventory[player.selectedItem], weaponKnockback2);
|
||||
float scaleFactor12 = player.inventory[player.selectedItem].shootSpeed * projectile.scale;
|
||||
player.PickAmmo(player.ActiveItem(), ref num42, ref scaleFactor11, ref flag16, ref weaponDamage2, ref weaponKnockback2, false);
|
||||
weaponKnockback2 = player.GetWeaponKnockback(player.ActiveItem(), weaponKnockback2);
|
||||
float scaleFactor12 = player.ActiveItem().shootSpeed * projectile.scale;
|
||||
Vector2 vector19 = vector;
|
||||
Vector2 value18 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - vector19;
|
||||
if (player.gravDir == -1f)
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
timeToFire = true;
|
||||
}
|
||||
|
||||
bool canFire = player.channel && player.HasAmmo(player.inventory[player.selectedItem], true) && !player.noItems && !player.CCed;
|
||||
bool canFire = player.channel && player.HasAmmo(player.ActiveItem(), true) && !player.noItems && !player.CCed;
|
||||
|
||||
if (projectile.soundDelay <= 0 && canFire)
|
||||
{
|
||||
@@ -91,13 +91,13 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
int type = 14;
|
||||
float scaleFactor = 18f;
|
||||
int damage = player.GetWeaponDamage(player.inventory[player.selectedItem]);
|
||||
float knockBack = player.inventory[player.selectedItem].knockBack;
|
||||
int damage = player.GetWeaponDamage(player.ActiveItem());
|
||||
float knockBack = player.ActiveItem().knockBack;
|
||||
|
||||
player.PickAmmo(player.inventory[player.selectedItem], ref type, ref scaleFactor, ref canFire, ref damage, ref knockBack, false);
|
||||
player.PickAmmo(player.ActiveItem(), ref type, ref scaleFactor, ref canFire, ref damage, ref knockBack, false);
|
||||
|
||||
type = ModContent.ProjectileType<DrataliornusFlame>();
|
||||
knockBack = player.GetWeaponKnockback(player.inventory[player.selectedItem], knockBack);
|
||||
knockBack = player.GetWeaponKnockback(player.ActiveItem(), knockBack);
|
||||
|
||||
Vector2 playerPosition = player.RotatedRelativePoint(player.MountedCenter, true);
|
||||
projectile.velocity = Main.screenPosition - playerPosition;
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
num26 = 5f;
|
||||
}
|
||||
projectile.damage = (int)(player.inventory[player.selectedItem].damage * player.RangedDamage());
|
||||
projectile.damage = (int)(player.ActiveItem().damage * player.RangedDamage());
|
||||
projectile.ai[0] += 1f;
|
||||
projectile.ai[1] += 1f;
|
||||
int num27 = 10;
|
||||
@@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
flag10 = true;
|
||||
if (Main.myPlayer == projectile.owner)
|
||||
{
|
||||
float scaleFactor5 = player.inventory[player.selectedItem].shootSpeed * projectile.scale;
|
||||
float scaleFactor5 = player.ActiveItem().shootSpeed * projectile.scale;
|
||||
Vector2 value12 = vector;
|
||||
Vector2 value13 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - value12;
|
||||
if (player.gravDir == -1f)
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
projectile.ai[1] = (float)(num40 - num41 * num39);
|
||||
flag15 = true;
|
||||
}
|
||||
bool flag16 = player.channel && player.HasAmmo(player.inventory[player.selectedItem], true) && !player.noItems && !player.CCed;
|
||||
bool flag16 = player.channel && player.HasAmmo(player.ActiveItem(), true) && !player.noItems && !player.CCed;
|
||||
if (projectile.localAI[0] > 0f)
|
||||
{
|
||||
projectile.localAI[0] -= 1f;
|
||||
@@ -107,13 +107,13 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
int num42 = 14;
|
||||
float scaleFactor11 = 14f;
|
||||
int weaponDamage2 = player.GetWeaponDamage(player.inventory[player.selectedItem]);
|
||||
float weaponKnockback2 = player.inventory[player.selectedItem].knockBack;
|
||||
int weaponDamage2 = player.GetWeaponDamage(player.ActiveItem());
|
||||
float weaponKnockback2 = player.ActiveItem().knockBack;
|
||||
if (flag16)
|
||||
{
|
||||
player.PickAmmo(player.inventory[player.selectedItem], ref num42, ref scaleFactor11, ref flag16, ref weaponDamage2, ref weaponKnockback2, false);
|
||||
weaponKnockback2 = player.GetWeaponKnockback(player.inventory[player.selectedItem], weaponKnockback2);
|
||||
float scaleFactor12 = player.inventory[player.selectedItem].shootSpeed * projectile.scale;
|
||||
player.PickAmmo(player.ActiveItem(), ref num42, ref scaleFactor11, ref flag16, ref weaponDamage2, ref weaponKnockback2, false);
|
||||
weaponKnockback2 = player.GetWeaponKnockback(player.ActiveItem(), weaponKnockback2);
|
||||
float scaleFactor12 = player.ActiveItem().shootSpeed * projectile.scale;
|
||||
Vector2 vector19 = vector;
|
||||
Vector2 value18 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - vector19;
|
||||
if (player.gravDir == -1f)
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
projectile.ai[1] = baseUseTime - modifier * projectile.localAI[0];
|
||||
timeToFire = true;
|
||||
}
|
||||
bool canFire = player.channel && player.HasAmmo(player.inventory[player.selectedItem], true) && !player.noItems && !player.CCed;
|
||||
bool canFire = player.channel && player.HasAmmo(player.ActiveItem(), true) && !player.noItems && !player.CCed;
|
||||
if (projectile.soundDelay <= 0 && canFire)
|
||||
{
|
||||
projectile.soundDelay = baseUseTime - modifier * (int)projectile.localAI[0];
|
||||
@@ -79,12 +79,12 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
int type = 12;
|
||||
float scaleFactor = 30f;
|
||||
int damage = player.GetWeaponDamage(player.inventory[player.selectedItem]);
|
||||
float knockBack = player.inventory[player.selectedItem].knockBack;
|
||||
int damage = player.GetWeaponDamage(player.ActiveItem());
|
||||
float knockBack = player.ActiveItem().knockBack;
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
player.PickAmmo(player.inventory[player.selectedItem], ref type, ref scaleFactor, ref canFire, ref damage, ref knockBack, false);
|
||||
knockBack = player.GetWeaponKnockback(player.inventory[player.selectedItem], knockBack);
|
||||
player.PickAmmo(player.ActiveItem(), ref type, ref scaleFactor, ref canFire, ref damage, ref knockBack, false);
|
||||
knockBack = player.GetWeaponKnockback(player.ActiveItem(), knockBack);
|
||||
Vector2 playerPosition = player.RotatedRelativePoint(player.MountedCenter, true);
|
||||
projectile.velocity = Main.screenPosition - playerPosition;
|
||||
projectile.velocity.X += Main.mouseX;
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
flag15 = true;
|
||||
int arg_1EF4_0 = (int)projectile.ai[0] / (num40 - num41 * num39);
|
||||
}
|
||||
bool flag16 = player.channel && player.HasAmmo(player.inventory[player.selectedItem], true) && !player.noItems && !player.CCed;
|
||||
bool flag16 = player.channel && player.HasAmmo(player.ActiveItem(), true) && !player.noItems && !player.CCed;
|
||||
if (projectile.localAI[0] > 0f)
|
||||
{
|
||||
projectile.localAI[0] -= 1f;
|
||||
@@ -77,13 +77,13 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
int num42 = 14;
|
||||
float scaleFactor11 = 14f;
|
||||
int weaponDamage2 = player.GetWeaponDamage(player.inventory[player.selectedItem]);
|
||||
float weaponKnockback2 = player.inventory[player.selectedItem].knockBack;
|
||||
int weaponDamage2 = player.GetWeaponDamage(player.ActiveItem());
|
||||
float weaponKnockback2 = player.ActiveItem().knockBack;
|
||||
if (flag16)
|
||||
{
|
||||
player.PickAmmo(player.inventory[player.selectedItem], ref num42, ref scaleFactor11, ref flag16, ref weaponDamage2, ref weaponKnockback2, false);
|
||||
weaponKnockback2 = player.GetWeaponKnockback(player.inventory[player.selectedItem], weaponKnockback2);
|
||||
float scaleFactor12 = player.inventory[player.selectedItem].shootSpeed * projectile.scale;
|
||||
player.PickAmmo(player.ActiveItem(), ref num42, ref scaleFactor11, ref flag16, ref weaponDamage2, ref weaponKnockback2, false);
|
||||
weaponKnockback2 = player.GetWeaponKnockback(player.ActiveItem(), weaponKnockback2);
|
||||
float scaleFactor12 = player.ActiveItem().shootSpeed * projectile.scale;
|
||||
Vector2 vector19 = vector;
|
||||
Vector2 value18 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - vector19;
|
||||
if (player.gravDir == -1f)
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
projectile.ai[1] = baseUseTime - modifier * projectile.localAI[0];
|
||||
timeToFire = true;
|
||||
}
|
||||
bool canFire = player.channel && player.HasAmmo(player.inventory[player.selectedItem], true) && !player.noItems && !player.CCed;
|
||||
bool canFire = player.channel && player.HasAmmo(player.ActiveItem(), true) && !player.noItems && !player.CCed;
|
||||
if (projectile.soundDelay <= 0 && canFire)
|
||||
{
|
||||
projectile.soundDelay = baseUseTime - modifier * (int)projectile.localAI[0];
|
||||
@@ -82,12 +82,12 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
int type = ModContent.ProjectileType<FallenStarProj>();
|
||||
float scaleFactor = 16f;
|
||||
int damage = player.GetWeaponDamage(player.inventory[player.selectedItem]);
|
||||
float knockBack = player.inventory[player.selectedItem].knockBack;
|
||||
player.PickAmmo(player.inventory[player.selectedItem], ref type, ref scaleFactor, ref canFire, ref damage, ref knockBack, false);
|
||||
int damage = player.GetWeaponDamage(player.ActiveItem());
|
||||
float knockBack = player.ActiveItem().knockBack;
|
||||
player.PickAmmo(player.ActiveItem(), ref type, ref scaleFactor, ref canFire, ref damage, ref knockBack, false);
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
knockBack = player.GetWeaponKnockback(player.inventory[player.selectedItem], knockBack);
|
||||
knockBack = player.GetWeaponKnockback(player.ActiveItem(), knockBack);
|
||||
Vector2 playerPosition = player.RotatedRelativePoint(player.MountedCenter, true);
|
||||
projectile.velocity = Main.screenPosition - playerPosition;
|
||||
projectile.velocity.X += Main.mouseX;
|
||||
|
||||
@@ -29,6 +29,9 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (Main.myPlayer != projectile.owner)
|
||||
return;
|
||||
|
||||
Player player = Main.player[projectile.owner];
|
||||
float num = 0f;
|
||||
Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true);
|
||||
@@ -46,33 +49,30 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
Main.PlaySound(SoundID.Item15, projectile.Center);
|
||||
projectile.soundDelay = 24;
|
||||
}
|
||||
if (Main.myPlayer == projectile.owner)
|
||||
{
|
||||
if (player.channel && !player.noItems && !player.CCed)
|
||||
{
|
||||
float scaleFactor6 = 1f;
|
||||
if (player.inventory[player.selectedItem].shoot == projectile.type)
|
||||
{
|
||||
scaleFactor6 = player.inventory[player.selectedItem].shootSpeed * projectile.scale;
|
||||
}
|
||||
Vector2 vector13 = Main.MouseWorld - vector;
|
||||
vector13.Normalize();
|
||||
if (vector13.HasNaNs())
|
||||
{
|
||||
vector13 = Vector2.UnitX * (float)player.direction;
|
||||
}
|
||||
vector13 *= scaleFactor6;
|
||||
if (vector13.X != projectile.velocity.X || vector13.Y != projectile.velocity.Y)
|
||||
{
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
projectile.velocity = vector13;
|
||||
}
|
||||
else
|
||||
{
|
||||
projectile.Kill();
|
||||
}
|
||||
}
|
||||
if (player.channel && !player.noItems && !player.CCed)
|
||||
{
|
||||
float scaleFactor6 = 1f;
|
||||
if (player.ActiveItem().shoot == projectile.type)
|
||||
{
|
||||
scaleFactor6 = player.ActiveItem().shootSpeed * projectile.scale;
|
||||
}
|
||||
Vector2 vector13 = Main.MouseWorld - vector;
|
||||
vector13.Normalize();
|
||||
if (vector13.HasNaNs())
|
||||
{
|
||||
vector13 = Vector2.UnitX * (float)player.direction;
|
||||
}
|
||||
vector13 *= scaleFactor6;
|
||||
if (vector13.X != projectile.velocity.X || vector13.Y != projectile.velocity.Y)
|
||||
{
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
projectile.velocity = vector13;
|
||||
}
|
||||
else
|
||||
{
|
||||
projectile.Kill();
|
||||
}
|
||||
Vector2 vector14 = projectile.Center + projectile.velocity * 3f;
|
||||
Lighting.AddLight(vector14, 0.2f, 2f, 3f);
|
||||
if (Main.rand.NextBool(3))
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
Player player = Main.player[projectile.owner];
|
||||
projectile.Center = player.Center;
|
||||
//if player is dead, null, or stops holding the Lion Heart, kill the projectile
|
||||
if (player.dead || player is null || player.HeldItem.type != ModContent.ItemType<LionHeart>())
|
||||
if (player.dead || player is null || player.ActiveItem().type != ModContent.ItemType<LionHeart>())
|
||||
{
|
||||
projectile.Kill();
|
||||
}
|
||||
|
||||
@@ -79,12 +79,12 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
if (projectile.velocity == Vector2.Zero)
|
||||
{
|
||||
// Immediately die if the player is not holding the spear
|
||||
if (player.HeldItem == null)
|
||||
if (player.ActiveItem() == null)
|
||||
{
|
||||
projectile.Kill();
|
||||
return;
|
||||
}
|
||||
if (player.HeldItem.type != ModContent.ItemType<RelicOfDeliverance>())
|
||||
if (player.ActiveItem().type != ModContent.ItemType<RelicOfDeliverance>())
|
||||
{
|
||||
projectile.Kill();
|
||||
return;
|
||||
|
||||
@@ -53,6 +53,7 @@ namespace CalamityMod
|
||||
public static CalamityGlobalNPC Calamity(this NPC npc) => npc.GetGlobalNPC<CalamityGlobalNPC>();
|
||||
public static CalamityGlobalItem Calamity(this Item item) => item.GetGlobalItem<CalamityGlobalItem>();
|
||||
public static CalamityGlobalProjectile Calamity(this Projectile proj) => proj.GetGlobalProjectile<CalamityGlobalProjectile>();
|
||||
public static Item ActiveItem(this Player player) => Main.mouseItem.IsAir ? player.HeldItem : Main.mouseItem;
|
||||
#endregion
|
||||
|
||||
#region Player Utilities
|
||||
@@ -302,7 +303,7 @@ namespace CalamityMod
|
||||
public static Rectangle FixSwingHitbox(float hitboxWidth, float hitboxHeight)
|
||||
{
|
||||
Player player = Main.player[Main.myPlayer];
|
||||
Item item = player.inventory[player.selectedItem];
|
||||
Item item = player.ActiveItem();
|
||||
float hitbox_X, hitbox_Y;
|
||||
float mountOffsetY = player.mount.PlayerOffsetHitbox;
|
||||
|
||||
@@ -2192,12 +2193,12 @@ namespace CalamityMod
|
||||
public static void DrawFishingLine(this Projectile projectile, int fishingRodType, Color poleColor, int xPositionAdditive = 45, float yPositionAdditive = 35f)
|
||||
{
|
||||
Player player = Main.player[projectile.owner];
|
||||
if (projectile.bobber && player.inventory[player.selectedItem].holdStyle > 0)
|
||||
if (projectile.bobber && player.ActiveItem().holdStyle > 0)
|
||||
{
|
||||
float pPosX = player.MountedCenter.X;
|
||||
float pPosY = player.MountedCenter.Y;
|
||||
pPosY += player.gfxOffY;
|
||||
int type = player.inventory[player.selectedItem].type;
|
||||
int type = player.ActiveItem().type;
|
||||
float gravDir = player.gravDir;
|
||||
|
||||
if (type == fishingRodType)
|
||||
|
||||
Reference in new issue
Block a user